(() => {
	let ele = {};
	ele.down = $('#down');
	ele.down2 = $('#down2');
	ele.sign_list = $('#sign_list');
	ele.sign7 = $('#sign7');
	ele.signConfirm = $('#signConfirm');
	ele.look = $('#look');
	ele.looknum = $('#looknum');
	ele.welfare = $('#welfare');
	ele.modal_welfare = $('#modal-welfare');
	ele.close_welfare = $('#close-welfare');
	ele.rank = $('#rank');
	ele.blind = $('#blind');
	ele.modal_blind = $('#modal-blind');
	ele.close_blind = $('#close-blind');
	ele.giveup = $('#giveup');
	ele.modal_present = $('#modal-present');
	ele.present = $('#present');
	ele.task = $('#task');
	ele.tips2 = $('#tips2');
	ele.tipsbtn = $('#tipsbtn');
	ele.modal_tips2 = $('#modal-tips2');
	ele.close_tips2 = $('#close-tips2');
	ele.recieveimg = $('#recieveimg');
	ele.recievenum = $('#recievenum');
	ele.trade = $('#trade');
	ele.close_trade = $('#close-trade');
	ele.modal_trade = $('#modal-trade');
	ele.buffList = $('#buffList');
	ele.heardimg = $('#heardimg');
	ele.nickname = $('#nickname');
	ele.yinbi = $('#yinbi');
	ele.jinbi = $('#jinbi');
	ele.jinbi2 = $('#jinbi2');
	ele.jinbi3 = $('#jinbi3');
	ele.rate = $('#rate');
	ele.techBox = $('#techBox');
	ele.tech = $('#tech');
	ele.modal_tech = $('#modal-tech');
	ele.close_tech = $('#close-tech');
	ele.fountainNum = $('#fountainNum');
	ele.giveconsume = $('#giveconsume');
	ele.giveshouxu = $('#giveshouxu');
	ele.giveipt = $('#giveipt');
	ele.giveid = $('#giveid');
	ele.giveconfirm = $('#giveconfirm');
	ele.modal_give = $('#modal-give');
	ele.close_give = $('#close-give');
	ele.modal_info = $('#modal-info');
	ele.close_info = $('#close-info');
	ele.openinfo = $('#openinfo');
	ele.infoname = $('#infoname');
	ele.infosex = $('#infosex');
	ele.infoid = $('#infoid');
	ele.infowx = $('#infowx');
	ele.copywx = $('#copywx');
	ele.infoqq = $('#infoqq');
	ele.copyqq = $('#copyqq');
	ele.infogroup = $('#infogroup');
	ele.infogroup2 = $('#infogroup2');
	ele.infotxt = $('#infotxt');
	ele.cardBox = $('#cardBox');
	ele.headpic = $('#headpic');
	ele.bag = $('#bag');
	ele.optionBox = $('#optionBox');
	ele.modal_commission = $('#modal-commission');
	ele.close_commission = $('#close-commission');
	ele.modal_exchange = $('#modal-exchange');
	ele.close_exchange = $('#close-exchange');
	ele.exchangeList = $('#exchangeList');
	ele.exchangeList2 = $('#exchangeList2');
	ele.transfer = $('#transfer');
	ele.modal_transfer2 = $('#modal-transfer2');
	ele.close_transfer2 = $('#close-transfer2');
	ele.ex_money = $('#ex_money');
	ele.ex_gold = $('#ex_gold');
	ele.ex_money2 = $('#ex_money2');
	ele.exchange_confirm = $('#exchange-confirm');
	ele.newApartment = $('#newApartment');
	ele.cuihui = $('#cuihui');
	ele.modal_tips4 = $('#modal-tips4');
	ele.close_tips4 = $('#close-tips4');
	ele.goldRecord = $('#goldRecord');
	ele.modal_gold = $('#modal-gold');
	ele.close_gold = $('#close-gold');
	ele.modal_build = $('#modal-build');
	ele.close_build = $('#close-build');
	ele.modal_build2 = $('#modal-build2');
	ele.close_build2 = $('#close-build2');
	ele.apartmoney = $('#apartmoney');
	ele.apartname = $('#apartname');
	ele.apartneed = $('#apartneed');
	ele.apartexplain = $('#apartexplain');
	ele.gohead = $('#gohead');
	ele.cs_detail = $('#cs_detail');
	ele.dangqian_cs = $('#dangqian_cs');
	ele.dangqian_cs2 = $('#dangqian_cs2');
	ele.jianzao = $('#jianzao');
	ele.modal_fountain = $('#modal-fountain');
	ele.close_fountain = $('#close-fountain');
	ele.fountain = $('#fountain');
	ele.fountain2 = $('#fountain2');
	ele.bgimg = $('#bgimg');
	ele.energy = $('#energy');
	ele.modal_recruit = $('#modal-recruit');
	ele.close_recruit = $('#close-recruit');
	ele.mubiaoNum = $('#mubiaoNum');
	ele.chushouNum = $('#chushouNum');
	ele.dangqianNum = $('#dangqianNum');
	ele.shoumaiNum = $('#shoumaiNum');
	// ele.yueNum = $('#yueNum');
	// ele.jianzaoNum = $('#jianzaoNum');
	// ele.csNum = $('#csNum');
	// ele.zmNum = $('#zmNum');
	ele.progressin1 = $('#progressin1');
	ele.progressin2 = $('#progressin2');
	ele.swiper_wrapper = $('#swiper-wrapper');
	ele.zone = $('#zone');
	ele.needNum = $('#needNum');
	ele.sellimg = $('#sellimg');
	ele.modal_sale = $('#modal-sale');
	ele.close_sale = $('#close-sale');
	ele.expand = $('#expand');
	ele.modal_expand = $('#modal-expand');
	ele.close_expand = $('#close-expand');
	ele.zm_confirm = $('#zm_confirm');
	ele.expandName = $('#expandName');
	ele.expandImg1 = $('#expandImg1');
	ele.expandImg11 = $('#expandImg11');
	ele.expandImg2 = $('#expandImg2');
	ele.expandProfit = $('#expandProfit');
	ele.expandBei = $('#expandBei');
	ele.expandNeed1 = $('#expandNeed1');
	ele.expandNeed2 = $('#expandNeed2');
	ele.expandConfirm = $('#expandConfirm');
	ele.zk_num = $('#zk_num');
	ele.zk_jb = $('#zk_jb');
	ele.cs_confirm = $('#cs_confirm');
	ele.yinbi_cs = $('#yinbi_cs');
	ele.jinbi_cs = $('#jinbi_cs');
	ele.btmListin = $('#btmListin');
	ele.imgde3_1 = $('#imgde3_1');
	ele.imgde3_2 = $('#imgde3_2');
	ele.recruitExplian = $('#recruitExplian');
	ele.modal_explian = $('#modal-explian');
	ele.close_explian = $('#close-explian');
	ele.close_explian2 = $('#close-explian2');
	ele.modal_jewelry = $('#modal-jewelry');
	ele.close_jewelry = $('#close-jewelry');
	ele.tuteng_name = $('#tuteng_name');
	ele.tuteng_img1 = $('#tuteng_img1');
	ele.tuteng_lv1 = $('#tuteng_lv1');
	ele.tuteng_img2 = $('#tuteng_img2');
	ele.tuteng_lv2 = $('#tuteng_lv2');
	ele.tuteng_img11 = $('#tuteng_img11');
	ele.tuteng_have = $('#tuteng_have');
	ele.tutengh_jinbi1 = $('#tutengh_jinbi1');
	ele.tutengh_jinbi2 = $('#tutengh_jinbi2');
	ele.duihuan = $('#duihuan');
	ele.tuteng_shengji = $('#tuteng_shengji');
	ele.adnum = $('#adnum');
	ele.adallnum = $('#adallnum');
	ele.bg = $('#bg');
	ele.listimg = $('#listimg');
	ele.oPointer = $('#pointer');
	ele.ad_add = $('#ad_add');
	ele.modal_tips = $('#modal-tips');
	ele.close_tips = $('#close-tips');
	ele.meiri_ad = $('#meiri_ad');
	ele.huifu_ad = $('#huifu_ad');
	ele.modal_extend = $('#modal-extend');
	ele.close_extend = $('#close-extend');
	ele.kj_cs = $('#kj_cs');
	ele.kj_cs2 = $('#kj_cs2');
	ele.kj_cs3 = $('#kj_cs3');
	ele.kj_name = $('#kj_name');
	ele.kj_ishow = $('#kj_ishow');
	ele.kj_css = $('#kj_css');
	ele.kj_cs2s = $('#kj_cs2s');
	ele.kj_cs3s = $('#kj_cs3s');
	ele.kj_names = $('#kj_names');
	ele.kj_ishows = $('#kj_ishows');
	ele.kj_cj_name = $('#kj_cj_name');
	ele.kj_gj_name = $('#kj_gj_name');
	ele.list_all = $('#list-all');
	ele.empty1 = $('#empty1');
	ele.more1 = $('#more1');
	ele.list_today = $('#list-today');
	ele.empty2 = $('#empty2');
	ele.more2 = $('#more2');
	ele.ad_action = $('#ad_action');
	ele.zhipin = $('#zhipin');
	ele.yeye1 = $('#yeye1');
	ele.kaiqiyinyue = $('#kaiqiyinyue');
	ele.yeyede = $('#yeyede');
	ele.modal_road = $('#modal-road');
	ele.close_road = $('#close-road');
	ele.yulan_tuteng_img = $('#yulan_tuteng_img');
	ele.yulan_tuteng_name = $('#yulan_tuteng_name');
	ele.yulan_tuteng_txt = $('#yulan_tuteng_txt');
	ele.modal_totem = $('#modal-totem');
	ele.close_totem = $('#close-totem');
	ele.openkuojian = $('#openkuojian');
	ele.bbtnbox = $('#bbtnbox');
	ele.toplv = $('#toplv');
	ele.seeadv = $('#seeadv');
	ele.mianfeiAdNum1 = $('#mianfeiAdNum1');
	ele.mianfeiAdNum2 = $('#mianfeiAdNum2');
	ele.mianfeiAdNum3 = $('#mianfeiAdNum3');
	ele.mianfeiAdNum7 = $('#mianfeiAdNum7');
	ele.mkad1 = $('#mkad1');
	ele.mkad2 = $('#mkad2');
	ele.mkad3 = $('#mkad3');
	ele.mkad7 = $('#mkad7');


	// 幸运数字
	ele.tips_number = $("#tips_number");
	ele.modal_number = $("#modal-number");
	ele.number_back = $("#number_back");
	ele.center_tijiao = $("#center_tijiao");
	ele.num_detlt_btn = $("#num_detlt_btn");
	ele.num_detlt_submit = $("#num_detlt_submit");
	ele.winning_record = $("#winning_record");
	ele.task_num = $("#task_num");
	ele.son_img = $("#son_img");
	ele.num_select = $("#num_select");
	ele.modal_species = $("#modal-species");
	ele.number3_img = $("#number3_img");
	ele.close_tips3 = $("#close-tips3");
	ele.number4_btn = $("#number4_btn");
	ele.modal_submitTo = $("#modal-submitTo");
	ele.modal_etails = $("#modal-details");
	ele.close_tips3 = $("#close-tips3");
	ele.son_num = $('#son_num');
	ele.num_text = $('#num_text');
	ele.close_details = $('#close_details');
	ele.modal_details = $('#modal-details');
	ele.numchance = $('#numchance');
	ele.djstext = $('#djstext');

	ele.yy_timer = $('#yy_timer');

	ele.modal_give2 = $('#modal-give2');
	ele.close_give2 = $('#close-give2');
	ele.jinbi4 = $('#jinbi4');
	ele.zhuan = $('#zhuan');
	ele.giveconfirm2 = $('#giveconfirm2');

	ele.idin = $('#idin');

	let ad_max_num = 1;
	let ad_see_num = 0;

	let time_yy = null;

	let quanju_yy = '';

	if (!getCookie('yy_xianzhi_time')) {
		setCookie('yy_xianzhi_time', 0)
	}
	
	setTimeout(()=> {
		setCookie('yy_xianzhi_time', 0)
	},1000)


	// 广告免费
	function adv_index() {
		let token = getCookie("token");
		ajax({
			url: API_PATH.ADVERTISEMENT_ADV_INDEX,
			method: 'GET',
			header: {
				'Authorization': token,
			},
			success: res => {
				if (res.code == 1) {
					ad_max_num = res.data.max_num;
					ad_see_num = res.data.see_num;
					ele.mianfeiAdNum1.innerHTML = res.data.lose_num + '<span class="">/' + res.data
						.all_num + '</span>'
					ele.mianfeiAdNum2.innerHTML = res.data.lose_num + '<span class="">/' + res.data
						.all_num + '</span>'
					ele.mianfeiAdNum3.innerHTML = res.data.lose_num + '<span class="">/' + res.data
						.all_num + '</span>'
					ele.mianfeiAdNum7.innerHTML = res.data.lose_num + '<span class="">/' + res.data
						.all_num + '</span>'
					if (res.data.lose_num >= res.data.all_num) {
						ele.mianfeiAdNum1.classList = 'mar5 fontred'
						ele.mianfeiAdNum2.classList = 'mar5 fontred'
						ele.mianfeiAdNum3.classList = 'mar5 fontred'
						ele.mianfeiAdNum7.classList = 'mar5 fontred'
					}
					// if(type == 1) {
						ele.ad_action.onclick = () => {
							adv_index();
							if (ad_see_num >= ad_max_num) {
								openTips('今日视频次数已达上限，请明日再来')
							} else {
								addTime();
								// console.log(getCookie('yy_xianzhi_time'))
								console.log(adjdh);
								if (adjdh == '' || adjdh == 0) {
									setCookie('yy_xianzhi_time', '1')
									extradata = 1;
									yeyedao();
									setTimeout(()=> {
										setCookie('yy_xianzhi_time', '0')
									},2000)
									// alert(adjdh);
									// return;
									if (device == 'ios') {
										loadPlayRewardVideo(1)
									} else if (device == 'android') {
										loadAd(1);
									} else {
										openTips('请下载安卓最新版体验')
									}
								}
							}
						}
						
					// }
					
				} else openTips(res.msg || '未知错误');
			}
		});
	}
	
	// setTimeout(()=> {
		ele.ad_action.onclick = () => {
			adv_index(1);
		}
	// },1000)
	
	// 广告领取免费
	function adv_index_reward(id) {
		let token = getCookie("token");
		ajax({
			url: API_PATH.ADVERTISEMENT_GET_RECORD,
			method: 'GET',
			header: {
				'Authorization': token,
			},
			data: {
				type: id
			},
			success: res => {
				if (res.code == 1) {
					openTips(res.msg);
					if (id == 1) {
						ele.tipsbtn.innerHTML = '领取';
						ele.tipsbtn.classList.remove('tips3_recieve');
						ele.recieveimg.src = '../img/home/yinbi3.png';
						ele.recievenum.innerHTML = yinyue_num + '银币';
						closeMdl(ele.modal_present);
						openMdl(ele.modal_tips2);
					}
					if (id == 2) {
						ini();
						closeMdl(ele.modal_tips);
					}
					if (id == 3) {
						closeMdl(ele.modal_fountain);
					}
					if (id == 7) {
						ele.tipsbtn.innerHTML = '领取';
						ele.tipsbtn.classList.remove('tips3_recieve');
						ele.recieveimg.src = '../img/home/yinbi3.png';
						ele.recievenum.innerHTML = rewardag.innerHTML + '银币';
						closeMdl(lx_reward);
						openMdl(ele.modal_tips2);
					}
					setTimeout(() => {
						adv_index();
						getJzList();
					}, 500)
				} else openTips(res.msg || '未知错误');
			}
		});
	}
	ele.mkad1.onclick = () => {
		adv_index_reward(1)
	}
	ele.mkad2.onclick = () => {
		adv_index_reward(2)
	}

	ele.mkad7.onclick = () => {
		adv_index_reward(7)
	}


	// 广告加速器
	function addTime() {
		let token = getCookie("token");
		ajax({
			url: API_PATH.ADVEERTISEMENT_ADD_TIME,
			method: 'get',
			header: {
				'Authorization': token,
			},

			success: res => {
				if (res.code == 1) {

				} else openTips(res.msg || '未知错误');
			}
		});
	}


	let zanwei = $('.zanwei');

	for (let i = 0; i < zanwei.length; i++) {
		zanwei[i].onclick = () => {
			openTips('暂未开放')
		}
	}


	// 杨阳 租户小烦恼
	ele.modal_worried = $('#modal-worried')
	ele.modal_worried_close = $('#modal-worried-close')
	ele.worrtitle = $('#worrtitle')
	ele.worriedList = $('#worriedList')

	ele.modal_worrget = $('#modal-worrget')
	ele.modal_worrget_close = $('#modal-worrget-close')
	ele.worrgetNum = $('#worrgetNum')
	ele.worrgetText = $('#worrget-text')

	let suiNum = null
	let yangyang = {};

	intil();

	function intil() {
		getUserInfo((res) => {
			ele.rank.style.display = res.no_ph == 1 ? 'none' : 'block'
		});
		// checkLogin();
		// adv_index();
		if (!sessionStorage.getItem('national')) {
			getshangxian();
			sessionStorage.setItem('national', 1)
		}
		zuhufannao();
		getJzList();
		getredPonit();
	}

	let uid = getCookie('userid');

	let device = getClientType();

	let page1 = 1;
	let page2 = 1;

	let pq_time = '';

	let yinyue_num = '';

	let is_guangg = 0;

	var gg_timer = null;

	let extradata = 0;

	let yinbiHammer = 0;

	let is_hong = '';

	let houseNum = '';

	let ggcishu = '';

	var inval = [null, null, null, null, null, null, null, null, null]; //定时器
	var inval2 = [null, null, null, null, null, null, null, null, null]; //定时器

	//打开 摧毁规则 交易规则
	ele.cuihui.onclick = () => {
		openMdl(ele.modal_tips4);
	}
	//关闭 摧毁规则 交易规则
	ele.close_tips4.onclick = () => {
		closeMdl(ele.modal_tips4);
	}
	//关闭 扩建成功
	ele.close_extend.onclick = () => {
		closeMdl(ele.modal_extend);
	}
	//关闭 获取途径 图腾
	ele.close_road.onclick = () => {
		closeMdl(ele.modal_road);
	}
	ele.openkuojian.onclick = () => {
		openMdl(ele.modal_totem);
	}
	//关闭 获取途径 许可证
	ele.close_totem.onclick = () => {
		closeMdl(ele.modal_totem);
	}
	//打开 转盘 广告
	ele.ad_add.onclick = () => {
		adv_index();
		openMdl(ele.modal_tips);
	}
	//关闭 转盘 广告
	ele.close_tips.onclick = () => {
		closeMdl(ele.modal_tips);
	}
	//打开 招募说明
	ele.recruitExplian.onclick = () => {
		openMdl(ele.modal_explian);
	}
	//关闭 招募说明
	ele.close_explian.onclick = () => {
		closeMdl(ele.modal_explian);
	}
	ele.close_explian2.onclick = () => {
		closeMdl(ele.modal_explian);
	}
	//关闭 图腾升级
	ele.close_jewelry.onclick = () => {
		closeMdl(ele.modal_jewelry);
	}

	//关闭 扩建
	ele.close_expand.onclick = () => {
		closeMdl(ele.modal_expand);
	}

	//关闭 售楼部 出售
	ele.close_sale.onclick = () => {
		closeMdl(ele.modal_sale);
	}
	//打开 能量房产
	ele.energy.onclick = () => {
		// guide.updateGuideId(101);
		guide.hideStrategy_6();
	}
	//关闭 招募租户
	ele.close_recruit.onclick = () => {
		closeMdl(ele.modal_recruit);
		// 刘欣 引导关闭 2023-6-18 13:33:02
		let ugid = guide.getUsersGuideId();
		if (~[75, 76].indexOf(ugid)) guide.hideSell_76();
	}

	//打开 喷泉
	ele.fountain.onclick = () => {
		console.log(houseNum);
		if (houseNum >= 1) {
			adv_index();
			gameWatchAdv(0);
		} else {
			openTips('请您建造房产，方可使用')
		}
		// getCongig()
		// openMdl(ele.modal_fountain);
	}
	//打开 喷泉
	ele.fountain2.onclick = () => {
		console.log(houseNum);
		if (houseNum >= 1) {
			adv_index();
			gameWatchAdv(0);
		} else {
			openTips('请您建造房产，方可使用')
		}
		// getCongig()
		// openMdl(ele.modal_fountain);
	}
	//关闭 喷泉
	ele.close_fountain.onclick = () => {
		closeMdl(ele.modal_fountain);
	}
	//打开 金币记录
	ele.goldRecord.onclick = () => {
		openMdl(ele.modal_gold);
	}
	//关闭 金币记录
	ele.close_gold.onclick = () => {
		closeMdl(ele.modal_gold);
	}

	//  音乐喷泉
	// gameWatchAdv(1);

	//打开 玩家信息
	ele.openinfo.onclick = () => {
		let giveid = ele.giveid.value;
		if (!giveid) {
			openTips('请输入正确的好友ID')
		} else searchUser(giveid);
	}
	//关闭 玩家信息
	ele.close_info.onclick = () => {
		closeMdl(ele.modal_info);
	}

	//打开 金币兑换
	ele.duihuan.onclick = () => {
		goldList();
		getBrickList(page2);
		getGoldList(page1);
		// openMdl(ele.modal_exchange);

		// 刘欣 引导 点击兑换金币 2023-6-18 14:05:28
		let ugid = guide.getUsersGuideId();
		if (~[76, 77, 80, 81, 82, 83].indexOf(ugid)) guide.hideWithdraw_80();
		else if (~[84, 85].indexOf(ugid)) guide.showWithdraw_84();
	}

	//关闭 金币兑换
	ele.close_exchange.onclick = () => {
		closeMdl(ele.modal_exchange);
	}

	//关闭 金币兑换 兑换内容
	ele.close_transfer2.onclick = () => {
		closeMdl(ele.modal_transfer2);
	}


	//关闭 人才任命
	ele.close_commission.onclick = () => {
		closeMdl(ele.modal_commission);
	}

	//打开 转赠
	ele.transfer.onclick = () => {
		toZs();
		// 刘欣 引导 查看转赠 2023-6-18 14:14:56
		let ugid = guide.getUsersGuideId();
		if (~[81, 82, 83].indexOf(ugid)) guide.hideWithdraw_81();
	}

	//关闭 转赠
	ele.close_give.onclick = () => {
		closeMdl(ele.modal_give);
		// 刘欣 引导 查看转赠 2023-6-18 15:01:20
		let ugid = guide.getUsersGuideId();
		if (~[83].indexOf(ugid)) guide.hideWithdraw_83();
	}

	//关闭 转赠
	ele.close_give2.onclick = () => {
		closeMdl(ele.modal_give2);
	}

	//打开 恭喜获得
	ele.tips2.onclick = () => {
		allMyGetBag()
		// ele.tipsbtn.innerHTML = '领取并感谢';
		// ele.tipsbtn.classList.add('tips3_recieve');
		// ele.recieveimg.src = '../img/check/1.png';
		// ele.recievenum.innerHTML = '555银币';
		// openMdl(ele.modal_tips2);
	}

	// 领取红包 发放
	function allMyGetBag() {
		let token = getCookie("token");
		ajax({
			url: API_PATH.ALL_MY_GET_BAG,
			method: 'POST',
			header: {
				'Authorization': token,
			},

			success: res => {
				if (res.code == 1) {
					ele.tipsbtn.innerHTML = '领取并感谢';
					ele.tipsbtn.classList.add('tips3_recieve');
					ele.recieveimg.src = '../img/check/1.png';
					ele.recievenum.innerHTML = res.data + '银币';
					openMdl(ele.modal_tips2);
					setTimeout(() => {
						getJzList();
					}, 500)
				} else openTips(res.msg || '未知错误');
			}
		});
	}


	//关闭 恭喜获得
	ele.close_tips2.onclick = () => {
		closeMdl(ele.modal_tips2);
		// location.reload(true);
		getJzList();
		getredPonit();
		// 刘欣 引导 出售房产 2023-6-18 11:03:05
		let ugid = guide.getUsersGuideId();
		if (~[72].indexOf(ugid)) guide.showSell_74();
	}
	ele.tipsbtn.onclick = () => {
		closeMdl(ele.modal_tips2);
		// location.reload(true);
		getJzList();
		getredPonit();
		// 刘欣 引导 获得免广告金币奖励 2023-6-17 20:45:10
		let ugid = guide.getUsersGuideId();
		if (!!~[52, 53].indexOf(ugid)) guide.showRecruit_60();
		// 引导 出售房产 2023-6-18 10:55:52
		else if (~[72, 73].indexOf(ugid)) guide.showSell_74();
	}

	//打开 科技
	ele.tech.onclick = () => {
		if (houseNum <= 8) {
			openTips('建造9个建筑后方可使用')
		} else {
			typeList();
			openMdl(ele.modal_tech);
		}
	}
	//关闭 科技
	ele.close_tech.onclick = () => {
		closeMdl(ele.modal_tech);
	}

	//打开 地段 地段
	ele.trade.onclick = () => {
		// 刘欣 引导 地段 2023-6-23 09:40:01
		let ugid = guide.getUsersGuideId();
		if (~[187, 190, 191, 192].indexOf(ugid)) guide.hideReach_190();
		jobList()
		openMdl(ele.modal_trade);
	}
	//关闭 地段 地段
	ele.close_trade.onclick = () => {
		// 刘欣 引导 地段 2023-6-23 09:40:01
		let ugid = guide.getUsersGuideId();
		if (~[192].indexOf(ugid)) guide.hideReach_192();
		closeMdl(ele.modal_trade);
	}

	//打开 爷爷的馈赠
	ele.present.onclick = () => {
		if (houseNum >= 1) {
			adv_index();
			getredPonit();
			gameWatchAdv(1);
		} else {
			openTips('建造建筑后方可使用')
		}
		// openMdl(ele.modal_present);
	}
	ele.yeyede.onclick = () => {
		if (houseNum >= 1) {
			gameWatchAdv(1);
		} else {
			openTips('建造建筑后方可使用')
		}
		// openMdl(ele.modal_present);
	}
	//关闭 爷爷的馈赠
	ele.giveup.onclick = () => {
		closeMdl(ele.modal_present);
	}

	//打开 签到 每日福利
	ele.welfare.onclick = () => {
		signList();
		openMdl(ele.modal_welfare);
	}
	//关闭 签到 每日福利
	ele.close_welfare.onclick = () => {
		closeMdl(ele.modal_welfare);
	}

	//打开 转盘
	ele.blind.onclick = () => {
		// openMdl(ele.modal_blind);
		if (houseNum >= 1) {
			ini();
		} else {
			openTips('建造建筑后方可使用')
		}
	}
	//关闭 转盘
	ele.close_blind.onclick = () => {
		closeMdl(ele.modal_blind);
	}
	//关闭 地皮建造1
	ele.close_build.onclick = () => {
		closeMdl(ele.modal_build);
	}

	//关闭 地皮建造2
	ele.close_build2.onclick = () => {
		closeMdl(ele.modal_build2);
	}

	// 排行榜
	ele.rank.onclick = () => {
		location.href = '../page/rank.html'
	}
	// 任务
	ele.task.onclick = () => {
		location.href = '../page/task.html'
	}
	// 背包
	ele.bag.onclick = () => {
		location.href = '../page/bag.html'
	}
	// 老板直聘
	ele.zhipin.onclick = () => {
		location.href = '../page/directEmploy.html'
	}






	// 幸运数字开始----------------
	// 打开幸运数子
	ele.tips_number.onclick = () => {
		getownnum();
		openMdl(ele.modal_number);
	};

	// 关闭幸运数字
	ele.number_back.onclick = () => {
		// ele.modal_number.style.display = "none";
		closeMdl(ele.modal_number);
	};

	ele.son_img.onclick = () => {
		openMdl(ele.modal_etails);
		closeMdl(ele.modal_number);
	};

	// /关闭提交确认
	ele.number3_img.onclick = () => {
		closeMdl(ele.modal_submitTo);
	};
	// 关闭领取金币
	ele.close_tips3.onclick = () => {
		closeMdl(ele.modal_species);
	};

	// 关闭幸运数字说明
	ele.close_details.onclick = () => {
		closeMdl(ele.modal_details);
	};

	ele.num_detlt_btn.onclick = () => {
		closeMdl(ele.modal_details);
	};

	// 幸运数字结束----------------





	// 杨阳 租户烦恼页面调用 (判断是否达到每日10次的上线)


	// jobList();
	// typeList();
	// getCongig();
	// toZs();
	// useList(3);
	// goldList();

	let zhaomuindex = 0;

	let next_house_id = '';

	let nowbg = 0; //背景风格

	let JzListData = '';

	let nowid = '';

	let tuteng_data = '';

	let shabi = [1, 1, 1, 1, 1, 1, 1, 1, 1];

	// setCookie('zhaomuNumList',shabi.jion(','));

	// 招募详情页 
	function recruitRecordIndex(slideindex) {
		let token = getCookie("token");
		ajax({
			url: API_PATH.RECRUIT_RECORD_INDEX,
			method: 'GET',
			header: {
				'Authorization': token,
			},
			success: res => {
				if (res.code == 1) {
					ele.mubiaoNum.innerHTML = res.data.sell_detail.class_id
					ele.chushouNum.innerHTML = res.data.sell_detail.reward
					ele.shoumaiNum.innerHTML = '￥' + res.data.sell_detail.get_money
					ele.dangqianNum.innerHTML = res.data.tenant_num + '人'
					// console.log(res.data.house_info);
					tuteng_data = res.data.house_info
					drawRecruitRecordIndex(res.data, slideindex)
				} else openTips(res.msg || '未知错误');
			}
		});
	}

	// 招募详情页 数据渲染
	function drawRecruitRecordIndex(data, slideindex) {
		let _data = data.house_info
		// console.log(_data);
		let tutengcls = '';
		let suodisplay = '';
		let str = '';
		nowid = _data[slideindex].h_id;
		ele.jinbi_cs.innerHTML = '+' + _data[slideindex].talent_money;
		let pj_type = '';
		// 人才任命
		if (_data[slideindex].talent_list.length < 8) {
			for (let i = 0; i < _data[slideindex].talent_list.length; i++) {
				// console.log(_data[slideindex].talent_list[i].prop_list.hammer);
				pj_type = _data[slideindex].talent_list[i].prop_list.hammer == 6 ? 'itemred' : _data[slideindex]
					.talent_list[i].prop_list.hammer == 2 ? 'itemgreen' : _data[slideindex].talent_list[i].prop_list
					.hammer == 3 ? 'itemblue' : _data[slideindex].talent_list[i].prop_list.hammer == 4 ?
					'itempurple' : _data[slideindex].talent_list[i].prop_list.hammer == 5 ? 'itemorange' : '';
				// console.log(pj_type);
				str += '<div class="xr_box ' + pj_type + '">' +
					'<button class="xr_btn" data="' + _data[slideindex].talent_list[i].shop.id + '">卸任</button>' +
					'<img class="drwimg" src="' + IMG_DOMAIN + _data[slideindex].talent_list[i].shop.lit_pic +
					'" alt="">' +
					'</div>'
			}
			for (let i = _data[slideindex].talent_list.length; i < 8; i++) {
				str += '<div class="">' +
					'<img class="jiarc" src="../img/home/jiajia.png" alt="">' +
					'</div>'
			}
		} else {
			for (let i = 0; i < _data[slideindex].talent_list.length; i++) {
				// console.log(_data[slideindex].talent_list[i].prop_list.hammer);
				pj_type = _data[slideindex].talent_list[i].prop_list.hammer == 6 ? 'itemred' : _data[slideindex]
					.talent_list[i].prop_list.hammer == 2 ? 'itemgreen' : _data[slideindex].talent_list[i].prop_list
					.hammer == 3 ? 'itemblue' : _data[slideindex].talent_list[i].prop_list.hammer == 4 ?
					'itempurple' : _data[slideindex].talent_list[i].prop_list.hammer == 5 ? 'itemorange' : '';
				str += '<div class="xr_box  ' + pj_type + '">' +
					'<button class="xr_btn" data="' + _data[slideindex].talent_list[i].shop.id + '">卸任</button>' +
					'<img class="drwimg" src="' + IMG_DOMAIN + _data[slideindex].talent_list[i].shop.lit_pic +
					'" alt="">' +
					'</div>'
			}
		}
		ele.btmListin.innerHTML = str

		// 点击  任命人才
		let jiarcs = $('.jiarc');
		for (let i = 0; i < jiarcs.length; i++) {
			jiarcs[i].onclick = () => {
				useList(nowid)
				// openMdl(ele.modal_commission);
			}
		}

		// 显示卸任按钮
		let xr_btns = $('.xr_btn');
		let xr_box = $('.xr_box');
		for (let i = 0; i < xr_box.length; i++) {
			xr_box[i].onclick = () => {
				xr_btns[i].style.display = 'block'
				xr_confirm()
			}
		}

		// 招募详情页 渲染
		let h_num = '';
		let imgsrc = '';
		let swiperHtml = '';
		let btnshiyong = '';

		for (let i = 0; i < _data.length; i++) {
			let j = i + 1;
			// console.log(_data[2].totem != '');
			tutengcls = _data[i].now_totem.type == 0 ? 'jiezhiimggray' : ''
			suodisplay = _data[i].now_totem.type != 0 ? '' : '<img class="suo2" src="../img/home/suo2.png" alt="">'
			btnshiyong = _data[i].now_totem.type == 0 ? '<button class="btnshiyong" data="' + _data[i].h_id +
				'">激活</button>' : '<button class="btnshiyong" data="' + _data[i].h_id + '">升级</button>';
			imgsrc = '../img/jianzu/' + j + _data[i].jz_level + '.png'
			// console.log(_data[i].jz_level);
			// let zhaoi = getCookie('zhaomuNumList').split(',')[i] == undefined ?  shabi[i] : getCookie('zhaomuNumList').split(',')[i] ;
			// console.log(shabi[i]);
			swiperHtml += '<div class="swiper-slide">' +
				'<div class="jianzao">' +
				'<p class="jiantit">' + _data[i].jz_name + '-' + _data[i].jz_level_txt + '</p>' +
				'<div class="jianzaoin">' +
				'<img src="' + imgsrc + '" alt="">' +
				'<div class="zaoin">' +
				'<div class="">' +
				'<img src="../img/home/yinbi.png" alt="">' +
				'<span>' + data.hammer + '</span>' +
				'</div>' +
				'<div class="">' +
				'<img src="../img/home/miao.png" alt="">' +
				'<span>' + _data[i].cs_num + '/秒</span>' +
				'</div>' +
				'<div class="">' +
				'<img src="../img/home/ren.png" alt="">' +
				'<span>' + _data[i].zm_num + '人</span>' +
				'</div>' +
				'</div>' +
				'<div class="gaiBox">' +
				'<div class="jiezhiimg" onclick="shengji(' + i + ')" data="' + j + '" data2="' + _data[i].h_id +
				'">' +
				'<img class="' + tutengcls + '" src="' + _data[i].totem_list[0].logo + '" alt="">' +
				suodisplay +
				'<span class="' + tutengcls + '">' + _data[i].totem_list[0].name + '</span>' +
				'</div>' +
				btnshiyong +
				'<img class="kjimg expand" id="guide-kuojian" src="../img/home/kj2.png" alt="">' +
				'</div>' +
				'</div>' +
				'<div class="guyong">' +
				'<p>招募租户:</p>' +
				'<span class="guyongNum">' + '' + '</span>' +
				'</div>' +
				'<div class="progress">' +
				'<span class="progressin1">' + _data[i].zm_lose_num + '/' + _data[i].zm_info.name + '</span>' +
				'<p class="progressin2"></p>' +
				'</div>' +
				'</div>' +
				'</div>';
			if (nowid == _data[i].h_id) {
				let jianzhao = _data[i].zm_info.name - _data[i].zm_lose_num
				ele.bbtnbox.innerHTML = '<button class="zmbtn zmbtn1" data="1">' +
					'<span>单次招募</span>' +
					'<div class="zmin">' +
					'<img src="../img/home/yinbi.png" alt="">' +
					'<p>' + _data[i].zm_list.one + '</p>' +
					'</div>' +
					'</button>' +
					'<button class="zmbtn zmbtn2" id="guide-zmbtn" data="10">' +
					'<span>十连招募</span>' +
					'<div class="zmin">' +
					'<img src="../img/home/yinbi.png" alt="">' +
					'<p>' + _data[i].zm_list.ten + '</p>' +
					'</div>' +
					'</button>' +
					'<button class="zmbtn zmbtn3" id="guide-zmbtn3" data="' + jianzhao + '">' +
					'<span>目标招募</span>' +
					'<div class="zmin">' +
					'<img src="../img/home/yinbi.png" alt="">' +
					'<p>' + _data[i].zm_list.max + '</p>' +
					'</div>' +
					'</button>'
			}
		}

		ele.swiper_wrapper.innerHTML = swiperHtml;

		sweper(_data, slideindex);

		let expands = $('.expand');
		// console.log(expands.length);
		for (let i = 0; i < expands.length; i++) {
			expands[i].onclick = () => {
				// for(let i = 0; i < _data.length;i++) {
				if (nowid == _data[i].h_id) {
					if (_data[i].jz_level == 4) {
						openTips('已经扩建到最高级了')
						// closeMdl(ele.modal_expand);
					} else {
						let j = i + 1;
						if (nowid == _data[i].h_id) {
							ele.expandName.innerHTML = _data[i].jz_name + '-' + _data[i].jz_level_txt
							ele.expandImg1.src = '../img/jianzu/' + j + _data[i].jz_level + '.png'
							ele.expandImg2.src = '../img/jianzu/' + j + (_data[i].jz_level + 1) + '.png'
							// ele.expandProfit.innerHTML = _data[i].jz_name+'租金收益'
							// ele.expandBei.innerHTML = 'x'+ _data[i].now_level.mul_num+'倍 → x'+ _data[i].next_level.mul_num+'倍';
							// console.log(data.kj_num);
							ele.expandNeed2.innerHTML = '/' + _data[i].next_level.sub

							// 扩建提前预览
							ele.kj_css.innerHTML = _data[i].now_level.mul_num + '倍→' + _data[i].next_level
								.mul_num + '倍';
							ele.kj_cs2s.innerHTML = _data[i].now_level.num + '/秒' + '→' + _data[i].next_level
								.num + '/秒';
							ele.kj_cs3s.innerHTML = _data[i].next_level.gold_num;
							ele.kj_names.innerHTML = _data[i].jz_name + '银币产速：';
							ele.kj_ishows.style.display = _data[i].next_level.gold_num != 0 ? 'flex' : 'none';
						}
						openMdl(ele.modal_expand);
						expandConfirm.onclick = () => {
							indexUpHouse(nowid);
							// 刘欣 引导
							let ugid = guide.getUsersGuideId();
							if (ugid <= 7) guide.hideExtension_7();
						}
					}
				}
				// }
			}
		}
		// h_num = getCookie('zhaomuNumList').split(',')[nowid - 3];
		// zzMoney(nowid,h_num)

		// 后面改的  招募
		let zmbtns = $('.zmbtn');
		for (let i = 0; i < zmbtns.length; i++) {
			zmbtns[i].onclick = () => {
				let num = zmbtns[i].getAttribute('data');
				recruitRecordToDo(nowid, num, zhaomuindex);
				// 刘欣 引导 2023-6-17 15:57:14
				let ugid = guide.getUsersGuideId();
				// 十连招
				if (ugid >= 12 && ugid <= 15) guide.hideRecruit_15();
				// 二次 十连招
				if (ugid == 61) {
					// 判定达到目标
					let num = /\d+/.exec($('#dangqianNum').innerText);
					num = num ? num[0] : 0;
					if (num >= 30) {
						// console.log('达成已目标');
						// guide.hideRecruit_61();
					}
				}
			}
		}

		// 激活  // 升级
		let btnshiyongs = $('.btnshiyong')
		for (let i = 0; i < btnshiyongs.length; i++) {
			btnshiyongs[i].onclick = () => {
				let num = btnshiyongs[i].getAttribute('data');
				for (let j = 0; j < _data.length; j++) {
					if (num == _data[j].h_id) {
						if (_data[j].now_totem.type == 0) {
							upTotem(_data[j].h_id)
							// console.log(_data[j].h_id);
						} else {
							if (_data[j].next_totem.length != 0) {
								ele.tuteng_name.innerHTML = _data[j].next_totem.name;
								ele.tuteng_lv1.innerHTML = 'LV' + _data[j].now_totem.type;
								ele.tuteng_lv2.innerHTML = 'LV' + _data[j].next_totem.type;
								ele.tutengh_jinbi1.innerHTML = '金币+' + _data[j].now_totem.money + '→';
								ele.tutengh_jinbi2.innerHTML = '金币+' + _data[j].next_totem.money;
								ele.tuteng_img1.src = _data[j].next_totem.logo;
								ele.tuteng_img2.src = _data[j].next_totem.logo;
								ele.tuteng_img11.src = _data[j].next_totem.logo;
								ele.tuteng_have.innerHTML = '<span>' + _data[j].my_totem_num + '</span>/' +
									_data[j].next_totem.num;
								openMdl(ele.modal_jewelry);
							} else {
								openTips('此图腾已经升到最高级')
							}
						}
					}
				}
			}
		}

		// 图腾预览
		let yulan_tuteng = $('.jiezhiimggray');
		for (let i = 0; i < yulan_tuteng.length; i++) {
			yulan_tuteng[i].onclick = () => {
				for (let j = 0; j < _data.length; j++) {
					if (yulan_tuteng[i].getAttribute('data2') == _data[j].h_id) {
						ele.yulan_tuteng_img.src = _data[j].totem_list[0].logo
						ele.yulan_tuteng_name.innerHTML = _data[j].totem_list[0].name
						ele.yulan_tuteng_txt.innerHTML = _data[j].totem_list[0].describe
						openMdl(ele.modal_road)
					}
				}
			}
		}

		// 进度条
		let progs = $('.progressin2');
		for (let i = 0; i < progs.length; i++) {
			// console.log(_data[i].zm_lose_num / _data[i].zm_info.name * 100);
			progs[i].style.width = _data[i].zm_lose_num / _data[i].zm_info.name * 100 + '%';
		}

		// 招募数量 动态变化
		let zhaoNums = $('.btnboxbtmin');
		let guyongNum = $('.guyongNum');

		// for(let j = 0; j < guyongNum.length; j++) {
		// for(let i = 0; i < zhaoNums.length; i++) {
		// 	zhaoNums[i].onclick = ()=> {
		// 		if(zhaoNums[i].getAttribute('data')){
		// 			console.log(i);
		// 			guyongNum[nowid - 3].innerHTML = '+' + zhaoNums[i].getAttribute('data');
		// 			shabi[nowid - 3] = guyongNum[nowid - 3].innerHTML
		// 			setCookie('zhaomuNumList',shabi.toString());
		// 			// console.log(getCookie('zhaomuNumList'));
		// 			h_num = zhaoNums[i].getAttribute('data')
		// 		}else {
		// 			for(let j = 0; j < _data.length; j++) {
		// 				// console.log(nowid,_data[j].h_id);
		// 				if(nowid == _data[j].h_id) {
		// 					h_num = _data[j].zm_info.name - _data[j].zm_lose_num
		// 					guyongNum[nowid - 3].innerHTML = h_num;
		// 					shabi[nowid - 3] = guyongNum[nowid - 3].innerHTML
		// 					setCookie('zhaomuNumList',shabi.toString());
		// 				}
		// 			}
		// 			console.log(h_num);
		// 			// console.log('招募最大需要计算');
		// 		}
		// 		zzMoney(nowid,h_num)
		// 	}
		// }
		// }

		// 确认招募
		// ele.zm_confirm.onclick = () => {
		// 	if(h_num == '') {
		// 		h_num = 1;
		// 		recruitRecordToDo(nowid,h_num,zhaomuindex)
		// 	} else {
		// 		recruitRecordToDo(nowid,h_num,zhaomuindex)
		// 	}
		// }

		//打开 售楼部 出售
		ele.sellimg.onclick = () => {
			for (let i = 0; i < _data.length; i++) {
				let j = i + 1;
				if (nowid == _data[i].h_id) {
					// ele.expandImg11.src = '../img/jianzu/'+j+_data[i].jz_level+'.png'
					ele.zk_num.innerHTML = data.tenant_num + '/' + data.sell_detail.class_id;
					ele.zk_jb.innerHTML = data.sell_detail.reward
					ele.tipsbtn.innerHTML = '领取';
					ele.tipsbtn.classList.remove('tips3_recieve');
					ele.recieveimg.src = '../img/home/jinbi3.png';
					ele.recievenum.innerHTML = data.sell_detail.reward + '金币';
				}
			}
			openMdl(ele.modal_sale);
			getshangxian();
			// 刘欣 引导 出售房产
			let ugid = guide.getUsersGuideId();
			if (!!~[61, 62, 70, 71, 72].indexOf(ugid)) guide.showSell_72();
		}


		ele.expandNeed1.innerHTML = data.kj_num == null ? 0 : data.kj_num
		//打开 扩建

		for (let i = 0; i < _data.length; i++) {
			if (nowid == _data[i].h_id) {
				if (_data[i].jz_level == 4) {
					// openTips('已经扩建到最高级了')
					closeMdl(ele.modal_expand);
				} else {
					let j = i + 1;
					if (nowid == _data[i].h_id) {
						ele.expandNeed1.className = data.kj_num == null || data.kj_num <= _data[i].next_level.sub ?
							'' : 'fontblue'
						ele.expandName.innerHTML = _data[i].jz_name + '-' + _data[i].jz_level_txt
						ele.expandImg1.src = '../img/jianzu/' + j + _data[i].jz_level + '.png'
						ele.expandImg2.src = '../img/jianzu/' + j + (_data[i].jz_level + 1) + '.png'
						// ele.expandProfit.innerHTML = _data[i].jz_name+'租金收益'
						// ele.expandBei.innerHTML = 'x'+ _data[i].now_level.mul_num+'倍 → x'+ _data[i].next_level.mul_num+'倍';
						// console.log(data.kj_num);
						ele.expandNeed2.innerHTML = '/' + _data[i].next_level.sub

						// 扩建提前预览
						ele.kj_css.innerHTML = _data[i].now_level.mul_num + '倍→' + _data[i].next_level.mul_num +
							'倍';
						ele.kj_cs2s.innerHTML = _data[i].now_level.num + '/秒' + '→' + _data[i].next_level.num +
							'/秒';
						ele.kj_cs3s.innerHTML = _data[i].next_level.gold_num;
						ele.kj_names.innerHTML = _data[i].jz_name + '银币产速：';
						ele.kj_ishows.style.display = _data[i].next_level.gold_num != 0 ? 'flex' : 'none';
					}
					// openMdl(ele.modal_expand);
					// expandConfirm.onclick = ()=> {
					// 	indexUpHouse(nowid);
					// }
				}
			}
		}

		openMdl(ele.modal_recruit);
	}

	// 图腾升级
	window.shengji = function shengji(number) {
		let nowlevel = '';
		if (tuteng_data[number].now_totem.type != 0) {
			nowlevel = tuteng_data[number].now_totem.type;
		}
		// console.log(nowlevel);
		// console.log(tuteng_data[number].next_totem.length != 0);
		// console.log(nowlevel>tuteng_data[number].totem_list[tuteng_data[number].totem_list.length -1 ].id);
		if (tuteng_data[number].next_totem.length != 0) {
			// for(let i = 0; i < tuteng_data[number].totem_list.length; i++) {
			// console.log(tuteng_data[number].totem_list[tuteng_data[number].totem_list.length -1 ].id);
			// let j = i +1;
			// if(nowlevel == tuteng_data[number].totem_list[i].id) {
			// ele.tuteng_name.innerHTML = tuteng_data[number].totem_list[i].name
			// ele.tuteng_lv1.innerHTML = 'LV' + tuteng_data[number].totem_list[i].id
			// ele.tuteng_lv2.innerHTML = 'LV' + (tuteng_data[number].totem_list[i].id + 1)
			// ele.tutengh_jinbi1.innerHTML = '金币+' + tuteng_data[number].totem_list[i].money
			// ele.tutengh_jinbi2.innerHTML = '金币+' + tuteng_data[number].totem_list[i+1].money
			// ele.tuteng_img1.src = tuteng_data[number].totem_list[i].logo
			// ele.tuteng_img2.src = tuteng_data[number].totem_list[i].logo
			// ele.tuteng_img11.src = tuteng_data[number].totem_list[i].logo
			// ele.tuteng_have.innerHTML = '<span>' + tuteng_data[number].my_totem_num + '</span>/' +  tuteng_data[number].totem_list[i].num
			// openMdl(ele.modal_jewelry)
			// }
			// } 
			ele.tuteng_name.innerHTML = tuteng_data[number].next_totem.name;
			ele.tuteng_lv1.innerHTML = 'LV' + tuteng_data[number].now_totem.type;
			ele.tuteng_lv2.innerHTML = 'LV' + tuteng_data[number].next_totem.type;
			ele.tutengh_jinbi1.innerHTML = '金币+' + tuteng_data[number].now_totem.money;
			ele.tutengh_jinbi2.innerHTML = '金币+' + tuteng_data[number].next_totem.money;
			ele.tuteng_img1.src = tuteng_data[number].next_totem.logo;
			ele.tuteng_img2.src = tuteng_data[number].next_totem.logo;
			ele.tuteng_img11.src = tuteng_data[number].next_totem.logo;
			ele.tuteng_have.innerHTML = '<span>' + tuteng_data[number].my_totem_num + '</span>/' + tuteng_data[
				number].next_totem.num;
			openMdl(ele.modal_jewelry);


		} else {
			openTips('此图腾已经升到最高级')
		}
	}

	// 确认升级该图腾
	ele.tuteng_shengji.onclick = () => {
		upTotem(nowid)
	}

	// 确认升级该图腾 接口
	function upTotem(h_id) {
		let token = getCookie("token");
		ajax({
			url: API_PATH.UP_TOTEM,
			method: 'POST',
			header: {
				'Authorization': token,
			},
			data: {
				h_id: h_id
			},
			success: res => {
				if (res.code == 1) {
					openTips(res.msg)
					closeMdl(ele.modal_jewelry)
					recruitRecordIndex(zhaomuindex);
				} else openTips(res.msg || '未知错误');
			}
		});
	}

	// 立即出售 出售房产
	ele.cs_confirm.onclick = () => {
		sellHouse();
		// 刘欣 引导 2023-6-18 10:49:12
		let ugid = guide.getUsersGuideId();
		if (~[70, 71, 72].indexOf(ugid)) guide.updateGuideId(73);
	}

	// 出售房产
	function sellHouse() {
		let token = getCookie("token");
		ajax({
			url: API_PATH.SELL_HOUSE,
			method: 'GET',
			header: {
				'Authorization': token,
			},
			success: res => {
				if (res.code == 1) {
					closeMdl(ele.modal_sale);
					openMdl(ele.modal_tips2);
					closeMdl(ele.modal_recruit);
					getJzList();
				} else openTips(res.msg || '未知错误');
			}
		});
	}



	// 招募所需金额
	function zzMoney(h_id, num) {
		let token = getCookie("token");
		ajax({
			url: API_PATH.ZZ_MONEY,
			method: 'POST',
			header: {
				'Authorization': token,
			},
			data: {
				h_id: h_id,
				num: num
			},
			success: res => {
				if (res.code == 1) {
					ele.needNum.innerHTML = res.data
				} else openTips(res.msg || '未知错误');
			}
		});
	}

	//卸任按钮 卸任
	function xr_confirm() {
		let xr_btns = $('.xr_btn');
		let xr_box = $('.xr_box');
		for (let i = 0; i < xr_btns.length; i++) {
			xr_btns[i].onclick = () => {
				// console.log(111);
				let c_id = xr_btns[i].getAttribute('data')
				rcToOut(c_id);
			}
		}
	}

	// swiper 
	function sweper(_data, slideindex) {
		var swiper = new Swiper(".mySwiper", {
			// pagination: '.swiper-pagination',
			noSwiping: true,
			on: {
				slideChange: function() {
					let str = '';
					// console.log(this.activeIndex);
					zhaomuindex = this.activeIndex
					// nowid = this.activeIndex;
					nowid = _data[this.activeIndex].h_id;
					for (let i = 0; i < _data.length; i++) {
						if (nowid == _data[i].h_id) {
							let jianzhao = _data[i].zm_info.name - _data[i].zm_lose_num
							ele.bbtnbox.innerHTML = '<button class="zmbtn zmbtn1" data="1">' +
								'<span>单次招募</span>' +
								'<div class="zmin">' +
								'<img src="../img/home/yinbi.png" alt="">' +
								'<p>' + _data[i].zm_list.one + '</p>' +
								'</div>' +
								'</button>' +
								'<button class="zmbtn zmbtn2" data="10">' +
								'<span>十连招募</span>' +
								'<div class="zmin">' +
								'<img src="../img/home/yinbi.png" alt="">' +
								'<p>' + _data[i].zm_list.ten + '</p>' +
								'</div>' +
								'</button>' +
								'<button class="zmbtn zmbtn3" data="' + jianzhao + '">' +
								'<span>目标招募</span>' +
								'<div class="zmin">' +
								'<img src="../img/home/yinbi.png" alt="">' +
								'<p>' + _data[i].zm_list.max + '</p>' +
								'</div>' +
								'</button>';
						}
					}

					// 后面改的  招募
					let zmbtns = $('.zmbtn');
					for (let i = 0; i < zmbtns.length; i++) {
						zmbtns[i].onclick = () => {
							let num = zmbtns[i].getAttribute('data')
							recruitRecordToDo(nowid, num, zhaomuindex)
						}
					}

					// h_num = getCookie('zhaomuNumList').split(',')[nowid - 3];
					// zzMoney(nowid,h_num)
					// console.log(_data[this.activeIndex].talent_money);
					ele.jinbi_cs.innerHTML = '+' + _data[this.activeIndex].talent_money;
					let pj_type = '';
					// console.log(_data[this.activeIndex].talent_list.length);
					if (_data[this.activeIndex].talent_list.length < 8) {
						for (let i = 0; i < _data[this.activeIndex].talent_list.length; i++) {
							pj_type = _data[this.activeIndex].talent_list[i].prop_list.hammer == 6 ?
								'itemred' : _data[this.activeIndex].talent_list[i].prop_list.hammer ==
								2 ? 'itemgreen' : _data[this.activeIndex].talent_list[i].prop_list
								.hammer == 3 ? 'itemblue' : _data[this.activeIndex].talent_list[i]
								.prop_list.hammer == 4 ? 'itempurple' : _data[this.activeIndex]
								.talent_list[i].prop_list.hammer == 5 ? 'itemorange' : '';
							// console.log(_data[this.activeIndex].talent_list[i].prop_list.hammer);
							// console.log(_data[this.activeIndex].talent_list.prop_list[i]);
							str += '<div class="xr_box ' + pj_type + '">' +
								'<button class="xr_btn" data="' + _data[this.activeIndex].talent_list[i]
								.shop.id + '">卸任</button>' +
								'<img class="drwimg" src="' + IMG_DOMAIN + _data[this.activeIndex]
								.talent_list[i].shop.lit_pic + '" alt="">' +
								'</div>'

						}
						for (let i = _data[this.activeIndex].talent_list.length; i < 8; i++) {
							str += '<div class="">' +
								'<img class="jiarc" src="../img/home/jiajia.png" alt="">' +
								'</div>'
						}
					} else {
						for (let i = 0; i < _data[this.activeIndex].talent_list.length; i++) {
							pj_type = _data[this.activeIndex].talent_list[i].prop_list.hammer == 6 ?
								'itemred' : _data[this.activeIndex].talent_list[i].prop_list.hammer ==
								2 ? 'itemgreen' : _data[this.activeIndex].talent_list[i].prop_list
								.hammer == 3 ? 'itemblue' : _data[this.activeIndex].talent_list[i]
								.prop_list.hammer == 4 ? 'itempurple' : _data[this.activeIndex]
								.talent_list[i].prop_list.hammer == 5 ? 'itemorange' : '';
							str += '<div class="xr_box ' + pj_type + '">' +
								'<button class="xr_btn" data="' + _data[this.activeIndex].talent_list[i]
								.shop.id + '">卸任</button>' +
								'<img class="drwimg" src="' + IMG_DOMAIN + _data[this.activeIndex]
								.talent_list[i].shop.lit_pic + '" alt="">' +
								'</div>'
						}
					}

					ele.btmListin.innerHTML = str;
					// console.log(nowid);

					let jiarcs = $('.jiarc');
					for (let i = 0; i < jiarcs.length; i++) {
						jiarcs[i].onclick = () => {
							useList(nowid)
							// openMdl(ele.modal_commission);
						}
					}

					let xr_btns = $('.xr_btn');
					let xr_box = $('.xr_box');
					for (let i = 0; i < xr_box.length; i++) {
						xr_box[i].onclick = () => {
							xr_btns[i].style.display = 'block'
							xr_confirm()
						}
					}
					// for(let i = 0; i < xr_btns.length; i++) {
					// 	xr_btns[i].onclick = ()=> {
					// 		console.log(111);
					// 		let c_id = xr_btns[i].getAttribute('data')
					// 		rcToOut(c_id);
					// 	}
					// }
					// jobDraw(_dataList)
				}
			},
			navigation: {
				nextEl: ".swiper-button-next",
				prevEl: ".swiper-button-prev",
			},
		});

		if (slideindex != '') {
			zhaomuindex = slideindex
		}
		swiper.slideTo(slideindex, 1000, false);

		// $(".swiper-pagination").on("click","",function(){
		// 	var index = $(this).index();
		// })

	}


	// 卸任人才
	function rcToOut(c_id) {
		let token = getCookie("token");
		ajax({
			url: API_PATH.TO_OUT,
			method: 'POST',
			header: {
				'Authorization': token,
			},
			data: {
				c_id: nowid, // 房产id
				id: c_id // 人才id
			},
			success: res => {
				if (res.code == 1) {
					openTips(res.msg);
					recruitRecordIndex(zhaomuindex);
				} else openTips(res.msg || '未知错误');
			}
		});
	}


	// 扩建房产
	function indexUpHouse(id) {
		let token = getCookie("token");
		ajax({
			url: API_PATH.INDEX_UPHOUSE,
			method: 'POST',
			header: {
				'Authorization': token,
			},
			data: {
				id: id
			},
			success: res => {
				if (res.code == 1) {
					ele.kj_cj_name.innerHTML = res.data.old.name == 1 ? '初级房产' : res.data.old.name ==
						2 ? '中级房产' : res.data.old.name == 3 ? '高级房产' : '特级房产';
					ele.kj_gj_name.innerHTML = res.data.new.name == 1 ? '初级房产' : res.data.new.name ==
						2 ? '中级房产' : res.data.new.name == 3 ? '高级房产' : '特级房产';
					ele.kj_cs.innerHTML = res.data.old.mul_num + '倍→' + res.data.new.mul_num + '倍';
					ele.kj_cs2.innerHTML = res.data.old.num + '/秒' + '→' + res.data.new.num + '/秒';
					ele.kj_cs3.innerHTML = res.data.new.gold_num;
					ele.kj_name.innerHTML = res.data.house_name + '银币产速：';
					// console.log(res.data.new.gold_num,res.data.new.gold_num != '0',res.data.new.gold_num == '0');
					// console.log();
					ele.kj_ishow.style.display = res.data.new.gold_num != 0 ? 'flex' : 'none';
					// openTips(res.msg,1111);
					recruitRecordIndex(zhaomuindex);
					// for(let i = 0; i < inval.length; i++) {
					// 	clearInterval(inval[i]);
					// }
					getJzList();
					openMdl(ele.modal_extend);
				} else openTips(res.msg || '未知错误');
			}
		});
	}
	window.indexUpHouse = indexUpHouse;

	// 招募租户
	function recruitRecordToDo(h_id, num, slideindex) {
		let token = getCookie("token");
		ajax({
			url: API_PATH.RECRUIT_RECORD_TO_DO,
			method: 'POST',
			header: {
				'Authorization': token,
			},
			data: {
				h_id: h_id,
				num: num
			},
			success: res => {
				if (res.code == 1) {
					// 刘欣 引导 目标招募30人 2023年6月18日11:42:30
					let ugid = guide.getUsersGuideId();
					if (~[61].indexOf(ugid)) {
						console.log(res);
						guide.hideRecruit_61();
					}
					// ↑↑↑↑↑ 引导结束
					openTips(res.msg);
					recruitRecordIndex(slideindex);
					getJzList();
				} else openTips(res.msg || '未知错误');
			}
		});
	}


	// 首页建筑列表
	function getJzList(fangid) {
		let token = getCookie("token");
		ajax({
			url: API_PATH.GET_JZ_LIST,
			method: 'GET',
			header: {
				'Authorization': token,
			},
			success: res => {
				if (res.code == 1) {
					for (let i = 0; i < inval.length; i++) {
						clearInterval(inval[i]);
					}
					// clearInterval(time_yy);
					// time_yy = setInterval(()=> {
					// 	if (res.data.yy_over_time * 1000 <= +new Date()) {
					// 	  clearInterval(time_yy);
					// 	  ele.yy_timer.innerHTML = ``;
					// 	  quanju_yy = 0;
					// 	  return;
					// 	}
					// 	quanju_yy = JSON.stringify(getCountTimeMin(res.data.yy_over_time))
					// 	// console.log(quanju_yy);
					// 	ele.yy_timer.innerHTML = getCountTimeMin(res.data.yy_over_time)
					// },1000)
					if (res.data.agent.info == null) {
						location.href = '../page/optionRole.html'
					} else {
						userInfo(res.data.agent)
					}
					getNum(res.data) //杨阳 获取随机数
					// if(fangid) {
					// 	redrawJzList(res.data,fangid,getNum(res.data)) 
					// } else {
					// 	drawJzList(res.data, getNum(res.data)) //杨阳 获取随机数
					// }
					drawJzList(res.data, getNum(res.data), fangid) //杨阳 获取随机数
					// drawJzList(res.data)
					JzListData = res.data;
					// nowbg = res.data.lot_list.id;
					// // pq_time = res.data.over_time;
					// // is_hong = res.data.hb_num;
					houseNum = res.data.house_num;
					// ele.tips2.style.display = res.data.hb_num == 0 ? 'none' : 'block';
					// if(nowbg == 1) {
					// 	ele.zone.style.backgroundColor = '#33adb8';
					// } else if(nowbg == 2) {
					// 	ele.zone.style.backgroundColor = '#a9ad31';
					// } else if(nowbg == 3) {
					// 	ele.zone.style.backgroundColor = '#156261';
					// } else if(nowbg == 4) {
					// 	ele.zone.style.backgroundColor = '#32b6ee';
					// } else if(nowbg == 5) {
					// 	ele.zone.style.backgroundColor = '#a7381a';
					// } else if(nowbg == 6) {
					// 	ele.zone.style.backgroundColor = '#e0cbeb';
					// }
					// ele.bgimg.src = '../img/jianzu/bg'+nowbg+'.png'
				} else openTips(res.msg || '未知错误');
			}
		});
	}

	// 领取房产收益 
	function getIncome(id) {
		let token = getCookie("token");
		ajax({
			url: API_PATH.GET_INCOME,
			method: 'POST',
			header: {
				'Authorization': token,
			},
			data: {
				h_id: id
			},
			success: res => {
				if (res.code == 1) {
					setTimeout(() => {
						// for(let i = 0; i < inval.length; i++) {
						// 	clearInterval(inval[i]);
						// }
						getJzList(id);
						// location.reload(true)
					}, 2000)
				} else openTips(res.msg || '未知错误');
			}
		});
	}

	// 杨阳 租户烦恼页面调用 (判断是否达到每日10次的上线)
	// getshangxian()
	function getshangxian() {
		let token = getCookie("token");
		ajax({
			url: API_PATH.ZUHUFANNAO,
			method: 'GET',
			header: {
				'Authorization': token,
			},
			success: res => {
				if (res.code == 1) {
					setCookie('fannaoNum', res.data.num)
					let startTime = null
					// console.log(getCookie('jianzhu'));
					if (res.data.house_num >= 1) {
						startTime = new Date().valueOf() + 300000
					} else {
						startTime = 1908060290000
					}

					// console.log(getCookie('fannaoDate'));
					// let startTime = new Date().valueOf() + 300000
					// 如果十次未到并且第一次进入没有存储，则可以设置cookie 
					// if (!getCookie('fannaoDate')) {
					// 	setCookie('fannaoDate', startTime)
					// }
					setCookie('fannaoDate', startTime)
				} else {
					setCookie('fannaoNum', null)
					// setCookie('gansuiNum', null)
				}
			}
		});
	}

	// 杨阳 定时器检查当前时间戳是否>=存储的时间戳 true则表示需要刷下页面并且出现提示的感叹号
	function zuhufannao() {
		yangyang.sivZuHuFanNao = setInterval(() => {
			// console.log(getCookie('fannaoNum'), '感叹号领取次数');
			// 刘欣 引导 未通过引导过滤租客烦恼 2023-7-10 19:26:46
			let ugid = guide.getUsersGuideId();
			if (ugid < 100) return false;
			if (new Date().valueOf() >= getCookie('fannaoDate')) {
				if (getCookie('fannaoNum') != 'null') {
					setTimeout(() => {
						for (let i = 0; i < inval.length; i++) {
							clearInterval(inval[i]);
						}
						getJzList();
					}, 2000)
					clearInterval(yangyang.sivZuHuFanNao);
				}
			}
		}, 1000);
	}

	// 杨阳  随机生成一个数 确定红色感叹号的位置
	// 如果10次领取次数已到 则不能产生随机数
	function getNum(_data) {
		if (getCookie('fannaoNum') == 'null') {
			suiNum = null
			return suiNum
		}
		// console.log(suiNum);
		// console.log(_data);
		let fandata = [] //确定首页建筑的数量
		for (let i = 0; i < _data.list.length; i++) {
			if (_data.list[i].jz_level) {
				fandata.push(_data.list[i].jz_level)
			}
		}
		// console.log(fandata);
		/* 如果没有点击感叹号，再次进入这页面时不能重新获取，只能从cookie中取 */
		// 第一次进入页面没有存在 gansuiNum 并且房子数不为0
		if (!getCookie('gansuiNum') && fandata.length != 0) {
			// max - 期望的最大值 
			// 如果为1 则表示 有房产会出现感叹号但是不会出现随机 不会5分钟循环一次
			if (fandata.length == 1) {
				// suiNum = 0
				// return suiNum
				if (new Date().valueOf() >= getCookie('fannaoDate')) {
					suiNum = 0
					return suiNum
				}
			} else {
				let max = fandata.length - 1
				suiNum = Math.floor(Math.random() * (max + 1)); //随机的数
				setCookie('gansuiNum', suiNum)
				return suiNum
			}

		} else if (getCookie('gansuiNum') == 'null' && fandata.length != 0) {
			if (fandata.length == 1) {
				if (new Date().valueOf() >= getCookie('fannaoDate')) {
					suiNum = 0
					return suiNum
				}
				// return suiNum = null
			} else {
				let max = fandata.length - 1
				suiNum = Math.floor(Math.random() * (max + 1)); //随机的数
				setCookie('gansuiNum', suiNum)
				return suiNum
			}
		} else if (getCookie('gansuiNum') && fandata.length != 0) {
			// 如果已经存在了cookie 并且房子数不为0
			// return getCookie('gansuiNum')
			if (new Date().valueOf() >= getCookie('fannaoDate')) {
				if (fandata.length - 1 >= getCookie('gansuiNum')) {
					suiNum = getCookie('gansuiNum')
				} else {
					suiNum = 0
				}
				return suiNum
			}
		} else if (fandata.length == 0) {
			// 如果为0 则表示 没有房产出现感叹号 不会5分钟循环一次
			return suiNum = null
		}

	}

	// 首页房产列表
	function drawJzList(_data, suiNum, fangid) {
		let html = '';
		let jz_img = '';
		let shouqian = '';

		if (fangid) {
			for (let i = 0; i < _data.list.length; i++) {
				if (_data.list[i].id == fangid) {
					// console.log(_data.list[i].id);
					let j = i + 1;
					jz_img = !_data.list[i].jz_level ? '' : '<img class="apartmentimg1" data="' + _data.list[i].id +
						'" src="../img/jianzu/' + j + _data.list[i].jz_level + '.png" alt="">'
					shouqian = !_data.list[i].jz_level ? '' :
						'<div class="cuizi" data="' + _data.list[i].id + '" data2="' + i + '">'
						// +'<img class="cuizi1" src="../img/home/top1.png" alt="">'
						+
						'<img class="cuizi2" src="../img/home/yinbi.png" alt="">'
						// +'<img class="cuizi21" src="../img/home/yinbi.png" alt="">'
						+
						'<img class="cuizi22" src="../img/home/yinbi.png" alt="">' +
						'<img class="cuizi23" src="../img/home/yinbi.png" alt="">' +
						'<img class="cuizi24" src="../img/home/yinbi.png" alt="">' +
						'<div class="cuizi5">' +
						'<img class="cuizi21" src="../img/home/yinbi.png" alt="">' +
						'<span class="getYinbi2 icon-font2">0</span>'
						// +'<span class="getYinbi3 icon-font2">0</span>'
						+
						'</div>' +
						'<div class="cuizi3">' +
						'<span class="getYinbi icon-font2">0</span>'
						// +'<span class="getYinbi2">0</span>'
						+
						'</div>' +
						'</div>'

					// 杨阳 随机感叹号出现
					let kk = null
					// console.log(suiNum == i, suiNum, i, '判断');
					if (suiNum == i) {
						kk = '<img onclick=opentan() class="gantan" src="../img/fannao/gantan.png" alt="">'
					} else if (suiNum == 'null') {
						kk = ''
					} else {
						kk = ''
					}

					// let jzLvels_is = _data.next_house[0].id;
					let jzLvels_is = _data.next_house.length != 0 ? _data.next_house[0].id : _data.list[_data.list
						.length - 1].id;
					let is_img_dipi = '../img/jianzu/dipi1.png';
					if (jzLvels_is == _data.list[i].id) {
						is_img_dipi = '../img/jianzu/dipi3.png';
					} else {
						is_img_dipi = '../img/jianzu/dipi1.png';
					}

					$('.apartment' + j).innerHTML = shouqian +
						'<div class="apartmentimg">' +
						kk +
						jz_img
						// +'<img class="apartmentimg1" src="../img/jianzu/1.png" alt="">'
						+
						'<img class="apartmentimg2" data="' + _data.list[i].id + '" src="' + is_img_dipi +
						'" alt="">' +
						'</div>'
				}
			}
		} else {
			for (let i = 0; i < _data.list.length; i++) {
				// console.log(!_data.list[i].jz_level);
				let j = i + 1;
				jz_img = !_data.list[i].jz_level ? '' : '<img class="apartmentimg1" data="' + _data.list[i].id +
					'" id="guide-jianzhu_' + j + '" src="../img/jianzu/' + j + _data.list[i].jz_level +
					'.png" alt="">'
				shouqian = !_data.list[i].jz_level ? '' :
					'<div class="cuizi" id="guide-cuizi_' + j + '" data="' + _data.list[i].id + '" data2="' + i +
					'">'
					// +'<img class="cuizi1" src="../img/home/top1.png" alt="">'
					+
					'<img class="cuizi2" src="../img/home/yinbi.png" alt="">'
					// +'<img class="cuizi21" src="../img/home/yinbi.png" alt="">'
					+
					'<img class="cuizi22" src="../img/home/yinbi.png" alt="">' +
					'<img class="cuizi23" src="../img/home/yinbi.png" alt="">' +
					'<img class="cuizi24" src="../img/home/yinbi.png" alt="">' +
					'<div class="cuizi5">' +
					'<img class="cuizi21" src="../img/home/yinbi.png" alt="">' +
					'<span class="getYinbi2 icon-font2">0</span>'
					// +'<span class="getYinbi3 icon-font2">0</span>'
					+
					'</div>' +
					'<div class="cuizi3">' +
					'<span class="getYinbi icon-font2">0</span>'
					// +'<span class="getYinbi2">0</span>'
					+
					'</div>' +
					'</div>'

				// html += '<div class="apartment apartment'+j+'" data="'+_data.list[i].id+'">'
				// 			+shouqian
				// 			+'<div class="apartmentimg">'
				// 				+jz_img
				// 				// +'<img class="apartmentimg1" src="../img/jianzu/1.png" alt="">'
				// 				+'<img class="apartmentimg2" data="'+_data.list[i].id+'" src="../img/jianzu/dipi1.png" alt="">'
				// 			+'</div>'
				// 		+'</div>'

				// 杨阳 随机感叹号出现
				let kk = null
				// console.log(suiNum == i, suiNum, i, '判断');
				if (suiNum == i) {
					kk = '<img onclick=opentan() class="gantan" src="../img/fannao/gantan.png" alt="">'
				} else if (suiNum == 'null') {
					kk = ''
				} else {
					kk = ''
				}

				let jzLvels_is = _data.next_house.length != 0 ? _data.next_house[0].id : _data.list[_data.list
					.length - 1].id;
				let is_img_dipi = '../img/jianzu/dipi1.png';
				if (jzLvels_is == _data.list[i].id) {
					is_img_dipi = '../img/jianzu/dipi3.png';
				} else {
					is_img_dipi = '../img/jianzu/dipi1.png';
				}

				html += '<div class="apartment apartment' + j + '" id="guide-apartment_' + j + '" data="' + _data
					.list[i].id + '">' +
					shouqian +
					'<div class="apartmentimg">' +
					kk +
					jz_img
					// +'<img class="apartmentimg1" src="../img/jianzu/1.png" alt="">'
					+
					'<img class="apartmentimg2" data="' + _data.list[i].id + '" src="' + is_img_dipi + '" alt="">' +
					'</div>' +
					'</div>'

				ele.newApartment.innerHTML = html;
			}
		}

		// 杨阳 点击感叹号弹出弹框 .租户小烦恼
		window.opentan = opentan

		function opentan() {
			let token = getCookie("token");
			ajax({
				url: API_PATH.ZUHUFANNAO,
				method: 'GET',
				header: {
					'Authorization': token,
				},
				success: res => {
					if (res.code == 1) {
						drawDetail2(res.data.worried.more_sku);
						ele.worrtitle.innerHTML = res.data.worried.describe
						// 刘欣 立马删除感叹号 2023-6-25 08:47:25
						let gt = $('.gantan')[0];
						gt.parentNode.removeChild(gt);
					} else openTips(res.msg);
				}
			});
		}

		function drawDetail2(data) {
			let str = '';
			for (let i = 0; i < data.length; i++) {
				let yy = data[i]
				str += '<p class="worrp fanrec-' + i + '" onclick=subOpen(' + i + ')>' + yy.answer + '</p>';
				// str += '<p class="worrp" onclick=subOpen(' + i + ')>' + yy.answer + '</p>';
			}
			ele.worriedList.innerHTML = str;
			ele.modal_worried.style.display = 'block'
		}
		ele.modal_worrget_close.onclick = () => {
			ele.modal_worrget.style.display = 'none';
			// 刘欣 关闭页面初始化提示文字
			ele.worrgetText.innerText = '恭喜获得现金，奖励已经进入钱包了哦';
			let ugid = guide.getUsersGuideId();
			// 引导 领取 建造 红包
			if (~[3, 4].indexOf(ugid)) guide.showBuild_4();
			// 引导 领取 扩建 红包
			if (~[8, 9].indexOf(ugid)) guide.hideExtension_9();
			// 引导 领取 扩建 红包
			if (~[16, 17].indexOf(ugid)) guide.showPresent_50();
			// 引导 领取 出售 红包 2023-6-18 11:19:30
			if (~[74, 75].indexOf(ugid)) guide.showSell_75();
		}
		// 点击租户烦恼问答选项 对的code==1 关闭租户烦恼弹框并获得奖励 错的code==0 不关闭租户弹框openTips提示
		window.subOpen = subOpen

		function subOpen(id) {
			let token = getCookie("token");
			ajax({
				url: API_PATH.GETQIANWORR,
				method: 'GET',
				header: {
					'Authorization': token,
				},
				data: {
					true_one: id
				},
				success: res => {
					if (res.code == 1) {
						ele.worrgetNum.innerHTML = res.data
						ele.modal_worried.style.display = 'none'
						ele.modal_worrget.style.display = 'block'
						// 领取成功时存储的加了五分钟的时间戳
						let startTime = new Date().valueOf() + 300000
						setCookie('fannaoDate', startTime) //重新设置过期时间
						setCookie('gansuiNum', null) //置为null重新获取随机数
						getshangxian() //重新获取感叹号次数
						setTimeout(() => {
							getJzList();
						}, 2000)
						zuhufannao();
					} else {
						// // 领取失败时存储的加了五分钟的时间戳
						// let startTime = new Date().valueOf() + 300000
						// setCookie('fannaoDate', startTime)//重新设置过期时间
						// setCookie('gansuiNum', null)//置为null重新获取随机数
						// getshangxian()//重新获取感叹号次数
						// setTimeout(() => {getJzList();
						// }, 2000)
						// openTips(res.msg);
						// zuhufannao();
						let btn = $('.fanrec-' + id)[0];
						if (id == 0) {
							$('.fanrec-' + 1)[0].classList.add('fanrecimg');
						} else if (id == 1) {
							$('.fanrec-' + 0)[0].classList.add('fanrecimg');
						}
						// let btns = $('.worrp')[0];
						// for (let i = 0; i < btns.length; i++) {
						// 	btns.classList.remove('fanrecimg');
						// }
						// // btn.classList.remove('weidu');
						// btn.classList.add('fanrecimg');
						// onclick = subOpen(id) = null

						// 领取失败时存储的加了五分钟的时间戳
						let startTime = new Date().valueOf() + 300000
						setCookie('fannaoDate', startTime) //重新设置过期时间
						setCookie('gansuiNum', null) //置为null重新获取随机数
						getshangxian() //重新获取感叹号次数
						setTimeout(() => {
							getJzList();
							ele.modal_worried.style.display = 'none'
						}, 2000)
						openTips(res.msg);
						zuhufannao();
					}
				}
			});
		}

		// 关闭租户小烦恼弹框
		ele.modal_worried_close.onclick = () => {
			ele.modal_worried.style.display = 'none'
		}




		// 点击房子 弹出 招募租户 弹窗
		let apartss = $('.apartmentimg1')
		for (let i = 0; i < apartss.length; i++) {
			apartss[i].onclick = () => {
				zhaomuindex = i
				recruitRecordIndex(i);
				nowid = apartss[i].getAttribute('data');
				// 刘欣 引导
				let ugid = guide.getUsersGuideId();
				if (ugid == 5) guide.hideExtension_5();
				// 引导 招募
				else if (ugid >= 12 && ugid <= 14) {
					guide.hideRecruit_12();
					// guide.showRecruit_13();
				}
				// 引导 二次招募 十连招30人 目标招募
				else if (~[53, 60].indexOf(ugid)) {
					guide.hideRecruit_60();
				}
				// 引导 出售房产
				else if (~[61].indexOf(ugid)) {
					// console.log(61);
					guide.hideRecruit_60();
				}
				// 引导 出售
				else if (!!~[62, 70, 71, 72].indexOf(ugid)) {
					guide.hideSell_70();
					setTimeout(() => {
						guide.showSell_71();
					}, 500);
				}
			}
		}

		let getYinbis = $('.getYinbi');
		let getYinbi2s = $('.getYinbi2');
		// let getYinbi3s = $('#getYinbi3');
		let shuzi = [null, null, null, null, null, null, null, null, null];
		let shuzi2 = [null, null, null, null, null, null, null, null, null];
		// let second = 1; //秒数 要是不收取 两小时 7200 后自动结束 
		let second = [0, 0, 0, 0, 0, 0, 0, 0, 0]; //秒数 要是不收取 两小时 7200 后自动结束
		let second2 = [0, 0, 0, 0, 0, 0, 0, 0, 0]; //秒数 要是不收取 两小时 7200 后自动结束
		let closeSecond = [0, 0, 0, 0, 0, 0, 0, 0, 0]; // 还有几秒结束
		let closeSecond2 = [0, 0, 0, 0, 0, 0, 0, 0, 0]; // 还有几秒结束
		for (let i = 0; i < getYinbis.length; i++) {
			// let closeSecond = '';  // 还有几秒结束
			// console.log(Number(_data.list[i].jc_num));
			getYinbis[i].innerHTML = Number(_data.list[i].jc_num) + _data.list[i].cs_unit;
			// getYinbi2s[i].style.display = 'none';
			// getYinbi2s[i].innerHTML = Number(_data.list[i].jc_num) + _data.list[i].cs_unit;
			shuzi[i] = Number(_data.list[i].jc_num);
			closeSecond[i] = parseInt(_data.list[i].ms_num);
			inval[i] = setInterval(() => {
				// console.log(shuzi[1]);
				second[i]++;
				if (second[i] >= closeSecond[i]) {
					clearInterval(inval[i]);
				} else {
					shuzi[i] = shuzi[i] + Number(_data.list[i].cs_num);
					if (shuzi[i] >= 1000) {
						for (let j = 0; j < inval.length; j++) {
							clearInterval(inval[j]);
						}
						getJzList(_data.list[i].id)
					}
					// console.log(shuzi);
					getYinbis[i].innerHTML = Math.floor(shuzi[i] * 100) / 100 + _data.list[i].cs_unit;
					// getYinbi2s[i].innerHTML = Math.floor(shuzi[i] * 100) / 100 + _data.list[i].cs_unit;
				}
			}, 1000)
		}

		// 飘起来的动画
		let cuizis = $('.cuizi');
		let cuizi21s = $('.cuizi21');
		let cuizi5s = $('.cuizi5');
		let cuizi22s = $('.cuizi22');
		let cuizi23s = $('.cuizi23');
		let cuizi24s = $('.cuizi24');
		for (let i = 0; i < cuizis.length; i++) {
			cuizis[i].onclick = () => {
				let id = cuizis[i].getAttribute('data');
				let id2 = cuizis[i].getAttribute('data2');
				let chuancan = getYinbis[i].innerHTML;
				getYinbi2s[i].innerHTML = chuancan;
				getIncome(id, id2);
				// getIncome(chuancan);
				// cuizi21s[i].classList.add('piao1')
				// getYinbi2s[i].style.display = 'block';
				// getYinbi2s[i].classList.add('piao1')
				cuizi5s[i].style.display = 'flex';
				cuizi5s[i].style.left = '0';
				cuizi5s[i].classList.add('piao1');
				// console.log(cuizi5s[i].classList);
				cuizi22s[i].classList.add('piao2')
				cuizi23s[i].classList.add('piao3')
				cuizi24s[i].classList.add('piao4')
				setTimeout(() => {
					// cuizi21s[i].classList.remove('piao1')
					cuizi22s[i].classList.remove('piao2')
					cuizi23s[i].classList.remove('piao3')
					cuizi24s[i].classList.remove('piao4')
					cuizi5s[i].style.display = 'none';
					cuizi5s[i].classList.remove('piao1');
				}, 2000)
				// 刘欣 新手引导
				let ugid = guide.getUsersGuideId();
				if (ugid == 10) guide.hideExtension_10();
			}
		}

		if (_data.next_house.length != 0) {
			// console.log(_data.next_house);
			next_house_id = _data.next_house[0].id;
		}

		let apartsipis = $('.apartmentimg2');
		for (let i = parseInt(_data.house_num); i < apartsipis.length; i++) {
			apartsipis[i].onclick = (e) => {
				dianji_id = apartsipis[i].getAttribute('data');
				for (let j = 0; j < _data.list.length; j++) {
					let q = i + 1;
					if (_data.list[j].id == dianji_id) {
						ele.imgde3_1.src = '../img/jianzu/' + q + '1.png'
						ele.imgde3_2.src = '../img/jianzu/' + q + '1.png'
						ele.apartname.innerHTML = _data.list[j].jz_name
						// ele.apartmoney.innerHTML = _data.list[j].class !== null ? _data.list[j].class.active : ''
						ele.apartexplain.innerHTML = _data.list[j].describe
						ele.apartneed.innerHTML = '建成【' + _data.next_house[0].jz_name + '】后可建造'
					}
					if (dianji_id == next_house_id) {
						// 刘欣 引导弹窗
						let ugid = guide.getUsersGuideId();
						if (ugid <= 2) guide.showBuild_2();
						else openMdl(ele.modal_build);
					} else {
						openMdl(ele.modal_build2);
					}
				}

				// 地皮建造2 打开 地皮建造1
				ele.gohead.onclick = () => {
					for (let j = 0; j < _data.list.length; j++) {
						let qw = j + 1;
						if (_data.list[j].id == next_house_id) {
							// console.log(j);
							ele.imgde3_2.src = '../img/jianzu/' + qw + '1.png'
							// ele.apartmoney.innerHTML = _data.list[j].class.active
						}
					}
					openMdl(ele.modal_build);
				}
			}
		}

		// console.log(next_house_id);
		let htmlDetail = '';
		let clsDetail = '';
		let lvDetail = '';
		for (let j = 0; j < _data.list.length; j++) {
			// console.log(_data.list[j].id, next_house_id);
			if (_data.list[j].id == next_house_id) {
				// ele.dangqian_cs.innerHTML = _data.list[j].active
				ele.dangqian_cs2.innerHTML = _data.list[j].active
				for (let q = 0; q < _data.list[j].more_sku.length; q++) {
					lvDetail = _data.list[j].more_sku[q].name == 1 ? '初级' : _data.list[j].more_sku[q].name == 2 ?
						'中级' : _data.list[j].more_sku[q].name == 3 ? '高级' : _data.list[j].more_sku[q].name == 4 ?
						'特级' : '';
					clsDetail = q == 0 ? '' : 'detail3';
					htmlDetail += '<div class="' + clsDetail + ' detail1">' +
						'<span>' + lvDetail + ':</span>' +
						'<img src="../img/home/yinbi.png" alt="">' +
						'<span>银币产速:</span>' +
						'<p class="luse">+' + _data.list[j].more_sku[q].num + '/秒</p>' +
						'</div>'
				}
				ele.cs_detail.innerHTML = htmlDetail;
			}
		}
	}

	// 确认建造
	ele.jianzao.onclick = () => {
		buyHouse();
		// setTimeout(() => {
		// 	 getshangxian()//杨阳
		// }, 500);
	}

	//  购买建筑 确认建造
	function buyHouse() {
		let token = getCookie("token");
		ajax({
			url: API_PATH.BUY_HOUSE,
			method: 'POST',
			header: {
				'Authorization': token,
			},
			data: {
				id: next_house_id
			},
			success: res => {
				if (res.code == 1) {
					openTips(res.msg);
					// for (let i = 0; i < inval.length; i++) {
					// 	clearInterval(inval[i]);
					// }
					getJzList();
					getshangxian() //杨阳
					closeMdl(ele.modal_build);
					closeMdl(ele.modal_build2);
					// 刘欣 引导 建造房产
					let ugid = guide.getUsersGuideId();
					if (~[2, 3].indexOf(ugid)) guide.showBuild_3();
				} else openTips(res.msg || '未知错误');
			}
		});
	}

	// 金币兑换列表
	function goldList() {
		let token = getCookie("token");
		ajax({
			url: API_PATH.GOLD_LIST,
			method: 'GET',
			header: {
				'Authorization': token,
			},
			success: res => {
				if (res.code == 1) {
					// openTips(res.msg);
					drawGoldList(res.data);
				} else openTips(res.msg || '未知错误');
			}
		});
	}

	//金币兑换 列表渲染
	function drawGoldList(_data) {
		let html = '';
		let html2 = '';
		let j = _data.length - 1;
		for (let i = 0; i < _data.length - 1; i++) {
			html += '<div class="ex_ce_list">' +
				'<div class="ex_ce_list_top">' +
				'<div class="ex_ce_list_top1">' +
				'<img src="../img/home/qb.png" alt="">' +
				'<span>￥' + _data[i].money + '</span>' +
				'</div>' +
				'<div class="ex_ce_list_top2">' +
				'<img src="../img/home/jinbi.png" alt="">' +
				'<span>' + _data[i].gold + '</span>' +
				'</div>' +
				'</div>' +
				'<button class="ex_btn" id="guide-ex_btn_' + i + '">兑换</button>' +
				'</div>'
		}
		html2 = '<div class="ex_price_in">' +
			'<img src="../img/exchange/bg1.png" alt="">' +
			'<p>今日价格：￥' + _data[j].money + '</p>' +
			'<div class="ex_price_in2">' +
			'<img src="../img/home/jinbi.png" alt="">' +
			'<span>' + _data[j].gold + '</span>' +
			'</div>' +
			'</div>' +
			'<button class="ex_btn ex_btn2">兑换</button>'
		ele.exchangeList.innerHTML = html;
		ele.exchangeList2.innerHTML = html2;

		openMdl(ele.modal_exchange);

		let ex_btns = $('.ex_btn');
		for (let i = 0; i < ex_btns.length; i++) {
			ex_btns[i].onclick = (e) => {
				// console.log(e.target.getAttribute('data'));
				// jobSynthesis(e.target.getAttribute('data'));
				ele.ex_money.innerHTML = _data[i].money + '大米';
				ele.ex_money2.innerHTML = _data[i].money;
				ele.ex_gold.innerHTML = _data[i].gold;
				openMdl(ele.modal_transfer2);
				exConfirm(_data[i].id)
				// 刘欣 引导 兑换确认 2023-6-18 15:24:23
				let ugid = guide.getUsersGuideId();
				if (~[83, 84, 85].indexOf(ugid)) guide.showWithdraw_85();
			}
		}
	}

	// 确认兑换金币
	function exConfirm(id) {
		ele.exchange_confirm.onclick = () => {
			goldConfirm(id);
			// 刘欣 引导 关闭兑换结果
			let ugid = guide.getUsersGuideId();
			if (~[83, 84, 85].indexOf(ugid)) guide.hideWithdraw_85();
		}
	}

	// 确认兑换金币 接口
	function goldConfirm(id) {
		let token = getCookie("token");
		ajax({
			url: API_PATH.GOLD_EXCHANGE,
			method: 'POST',
			header: {
				'Authorization': token,
			},
			data: {
				id: id
			},
			success: res => {
				if (res.code == 1) {
					openTips(res.msg);
					// for (let i = 0; i < inval.length; i++) {
					// 	clearInterval(inval[i]);
					// }
					closeMdl(ele.modal_transfer2);
					getJzList();
				} else openTips(res.msg || '未知错误');
			}
		});
	}

	// 检索用户
	function searchUser(id) {
		let token = getCookie("token");
		ajax({
			url: API_PATH.SEARCH_USER,
			method: 'GET',
			header: {
				'Authorization': token,
			},
			data: {
				code: id
			},
			success: res => {
				if (res.code == 1) {
					ele.infoname.innerHTML = res.data.nick_name
					let sex = res.data.sex == 1 ? '男' : '女';
					let age = res.data.age == null ? '0' : res.data.age
					ele.infosex.innerHTML = '性别：' + sex + '    年龄：' + age;
					ele.infoid.innerHTML = 'ID:' + res.data.invite_code;
					ele.infowx.innerHTML = res.data.wechat_no == null || res.data.wechat_no == '' ?
						'微信号暂未设置' : res.data.wechat_no;
					ele.infoqq.innerHTML = res.data.qq_no == null || res.data.qq_no == '' ?
						'QQ号暂未设置' : res.data.qq_no;
					ele.infogroup.src = IMG_DOMAIN + res.data.qrcode;
					if (res.data.vip == 0) {
						ele.idin.style.display = 'none'
					} else {
						ele.idin.innerHTML = '<img src="../img/home/zuan' + res.data.vip +
							'.png" alt=""><span>v' + res.data.vip + '</span>'
						ele.idin.style.display = 'block'
					}
					if (res.data.qrcode == null) {
						ele.infogroup.style.display = 'none'
						ele.infogroup2.style.display = 'block'
					} else {
						ele.infogroup.style.display = 'block'
						ele.infogroup2.style.display = 'none'
					}
					ele.infotxt.innerHTML = res.data.introduce == null || res.data.introduce == '' ?
						'ta很懒，什么都没有介绍~' : res.data.introduce;
					if (res.data.head_pic == null) {
						ele.headpic.src = res.data.sex == 1 ? '../img/my/tx1.png' : '../img/my/tx2.png'
					} else {
						ele.headpic.src = IMG_DOMAIN + res.data.head_pic;
					}
					let htmlcard = '';
					for (let i = 0; i < res.data.house_list.length; i++) {
						htmlcard += '<div class="infoCard">' +
							'<div class="card1">' +
							'<img src="../img/home/fcz.png" alt="">' +
							'<span>X' + res.data.house_list[i].zs_card_record.has_num + '</span>' +
							'</div>' +
							'<p class="card2">' + res.data.house_list[i].name + '</p>' +
							' </div>';
					}
					ele.cardBox.innerHTML = htmlcard
					openMdl(ele.modal_info);
					ele.copywx.onclick = () => {
						copy(ele.infowx.innerHTML)
						if (ele.infowx.innerHTML) {
							openTips('复制成功~')
						} else {
							openTips('复制失败，请手动复制~')
						}
					}
					ele.copyqq.onclick = () => {
						copy(ele.infoqq.innerHTML)
						if (ele.infoqq.innerHTML) {
							openTips('复制成功~')
						} else {
							openTips('复制失败，请手动复制~')
						}
					}
				} else openTips(res.msg || '未知错误');
			}
		});
	}

	// 监听 转赠数量
	ele.giveipt.oninput = () => {
		// console.log(ele.giveipt.value);
		let num = ele.giveipt.value;
		let shouxufei = Math.floor(num * givesxf) / 100;
		ele.giveconsume.innerHTML = parseInt(num) + shouxufei || 0;
	}

	// 转赠 确认
	ele.giveconfirm.onclick = () => {
		let giveid = ele.giveid.value;
		let givenum = ele.giveipt.value;
		ele.zhuan.innerHTML = '确认转赠' + givenum + '金币给' + giveid + '玩家吗？'
		openMdl(ele.modal_give2);

		// zsDq(giveid,givenum);
	}

	ele.giveconfirm2.onclick = () => {
		let giveid = ele.giveid.value;
		let givenum = ele.giveipt.value;
		closeMdl(ele.modal_give2);
		zsDq(giveid, givenum);
	}

	function zsDq(id, num) {
		let token = getCookie("token");
		ajax({
			url: API_PATH.ZS_DQ,
			method: 'GET',
			header: {
				'Authorization': token,
			},
			data: {
				code: id,
				num: num
			},
			success: res => {
				if (res.code == 1) {
					openTips(res.msg);
					toZs();
					getJzList();
					ele.list_today.innerHTML = '';
					ele.list_all.innerHTML = '';
					getBrickList(1);
					getGoldList(1);
				} else openTips(res.msg || '未知错误');
			}
		});
	}

	// 转赠  手续费
	function toZs() {
		let token = getCookie("token");
		ajax({
			url: API_PATH.TO_ZS,
			method: 'GET',
			header: {
				'Authorization': token,
			},
			success: res => {
				if (res.code == 1) {
					givesxf = res.data.sxf;
					ele.jinbi2.innerHTML = res.data.my_gold;
					ele.jinbi4.innerHTML = res.data.my_gold;
					ele.giveshouxu.innerHTML = '当前额外摧毁' + res.data.sxf + '%金币';
					openMdl(ele.modal_give);
				} else openTips(res.msg || '未知错误');
			}
		});
	}

	// 音乐喷泉
	function getCongig() {
		let token = getCookie("token");
		ajax({
			url: API_PATH.GET_CONGIG,
			method: 'GET',
			header: {
				'Authorization': token,
			},
			success: res => {
				if (res.code == 1) {
					if (pq_time == '') {
						ele.fountainNum.innerHTML = '房产美观度增加<br /><span id="daojishi">' + res.data
							.follow_give + '</span>内获得' + res.data.diamond_convert + '倍银币收益'
						ele.kaiqiyinyue.classList.remove('pq_gary');
						ele.mkad3.classList.remove('pq_gary');
						ele.mkad3.onclick = () => {
							adv_index_reward(3)
						}
						ele.kaiqiyinyue.onclick = () => {
							adv_index();
							if (ad_see_num >= ad_max_num) {
								openTips('今日视频次数已达上限，请明日再来')
							} else {
								addTime();
								if (is_guangg == 0) {
									is_guangg = 1

									extradata = 3;

									setTimeout(() => {
										is_guangg = 0
									}, 2000)

									if (device == 'ios') {
										loadPlayRewardVideo(3)
									} else if (device == 'android') {
										loadAd(3);
									} else {
										openTips('请下载安卓最新版体验')
									}
								}
							}
						}
					} else {
						let daojishi = $('#daojishi');
						let sval = setInterval(() => {
							if (pq_time <= 0) {
								sval = null
							} else {
								ele.fountainNum.innerHTML =
									'房产美观度增加<br /><span id="daojishi">' + getCountTime(
										pq_time) + '</span>内获得' + res.data.diamond_convert +
									'倍银币收益'
								// daojishi.innerHTML = getCountTime(pq_time)
								ele.kaiqiyinyue.onclick = null;
								ele.mkad3.onclick = null;
							}
						}, 1000)
						ele.kaiqiyinyue.classList.add('pq_gary')
						ele.mkad3.classList.add('pq_gary')
					}
					openMdl(ele.modal_fountain);
				} else openTips(res.msg || '未知错误');
			}
		});
	}

	// 科技列表
	function typeList() {
		let token = getCookie("token");
		ajax({
			url: API_PATH.TYPE_LIST,
			method: 'GET',
			header: {
				'Authorization': token,
			},
			success: res => {
				if (res.code == 1) {
					typeListDraw(res.data);
				} else openTips(res.msg || '未知错误');
			}
		});
	}

	// 升级科技
	window.upTechnology = function upTechnology(index) {
		let token = getCookie("token");
		ajax({
			url: API_PATH.UP_TECHNOLOGY,
			method: 'POST',
			header: {
				'Authorization': token,
			},
			data: {
				id: index
			},
			success: res => {
				if (res.code == 1) {
					openTips(res.msg);
					// typeListDraw(res.data);
					typeList();
					// for (let i = 0; i < inval.length; i++) {
					// 	clearInterval(inval[i]);
					// }
					getJzList();
					// closeMdl(ele.modal_tech)
				} else openTips(res.msg || '未知错误');
			}
		});
	}


	function typeListDraw(_data) {
		let html = '';
		for (let i = 0; i < _data.length; i++) {
			let j = i + 1;
			let huise = _data[i].can_click == 0 ? 'pq_gary' : 'pq_blue';
			console.log(_data[i].can_click);
			html += '<div class="tech">' +
				'<img src="../img/jianzu/' + j + '1.png" alt="">' +
				'<span>' + _data[i].name + '</span>' +
				'<div class="techin ' + huise + '" data="' + _data[i].id + '">' +
				'<img src="../img/home/yinbi.png" alt="">' +
				'<span>' + _data[i].money_txt + '</span>' +
				'</div>' +
				'</div>'
		}

		ele.techBox.innerHTML = html;

		let techs = $('.pq_blue')
		for (let i = 0; i < techs.length; i++) {
			techs[i].onclick = () => {
				// console.log(houseNum);
				// if(houseNum < 8) {
				// 	openTips('建造9个建筑后方可使用')
				// }else {
				let id = techs[i].getAttribute('data')
				upTechnology(id)
				// }
			}
		}
	}

	// 人才任命 列表
	function useList(type) {
		let token = getCookie("token");
		ajax({
			url: API_PATH.USE_LIST,
			method: 'GET',
			header: {
				'Authorization': token,
			},
			data: {
				c_id: type //房产id
			},
			success: res => {
				if (res.code == 1) {
					useListDraw(res.data)
				} else openTips(res.msg || '未知错误');
			}
		});
	}

	// 人才任命 数据渲染
	function useListDraw(_data) {
		let html = '';
		let pj_type = '';
		let money = '';
		if (_data == '' || _data == null) {
			openTips('暂无可用人才')
		} else {
			for (let i = 0; i < _data.length; i++) {
				// console.log();
				pj_type = _data[i].pj_type == 1 ? 'optiongreen' : _data[i].pj_type == 2 ? 'optionzise' :
					'optionorange';
				money = _data[i].type == 2 ? _data[i].shop.money : _data[i].shop.jj_money;
				html += '<div class="option ' + pj_type + '" onclick="toUse(' + _data[i].c_id + ',' + _data[i].shop
					.id + ')">' +
					'<div class="optionin">' +
					'<img src="' + IMG_DOMAIN + _data[i].shop.logo + '" alt="">' +
					'<div class="suipian2">' +
					'<p>技能:</p>' +
					'<img src="../img/home/jinbi.png" alt="">' +
					'<p>+' + money + '</p>' +
					'</div>' +
					'</div>' +
					'<span class="name">' + _data[i].shop.name + '</span>' +
					'</div>'
			}
			ele.optionBox.innerHTML = html;
			openMdl(ele.modal_commission);
		}

	}


	window.toUse = function toUse(cid, id) {
		let token = getCookie("token");
		ajax({
			url: API_PATH.TO_USE,
			method: 'POST',
			header: {
				'Authorization': token,
			},
			data: {
				c_id: cid, //房产id
				id: id //人才id
			},
			success: res => {
				if (res.code == 1) {
					closeMdl(ele.modal_commission);
					recruitRecordIndex(zhaomuindex);
					openTips(res.msg);
				} else openTips(res.msg || '未知错误');
			}
		});
	}

	//地段列表
	function jobList() {
		let token = getCookie("token");
		ajax({
			url: API_PATH.JOB_LIST,
			method: 'GET',
			header: {
				'Authorization': token,
			},
			success: res => {
				if (res.code == 1) {
					jobDraw(res.data);
				}
				// else openTips(res.msg);
			}
		});
	}

	function jobDraw(_data) {
		let html = '';
		let ishas = ''; //0 未拥有  1 已拥有
		let isuse = ''; //0 未使用  1 已使用
		let btntxt = '';
		let btncls = '';
		let daynum = '';
		let txt = '';
		let cls = '';
		let time = '';
		let suo = '';
		let yinying = '';
		let firstimg = '<img src="../img/home/buff.png" alt="">';
		let is_get = '';
		let is_block = 'none';

		for (let i = 0; i < _data.length; i++) {
			ishas = _data[i].is_has == 1 ? '1' : '0';
			is_block = _data[_data.length - 1].is_has == 1 ? 'block' : 'none';
			isuse = _data[i].is_use == 1 ? '1' : '0';
			day_num = _data[i].day_num == 1 ? '1' : '0';
			txt = _data[i].is_has == 1 ? '已生效' : '未生效';
			cls = _data[i].is_has == 1 ? 'buff3' : 'buffRed';
			time = _data[i].day_num == 0 ? '永久有效' : '有效' + _data[i].day_num + '天';

			// console.log(ishas == 1 && isuse == 1);
			if (ishas == 1 && isuse == 1) { //拥有且使用
				btntxt = '使用中';
				btncls = 'buff4';
				suo = ''
				yinying = '';
			} else if (ishas == 1 && isuse == 0) { //拥有未使用
				btntxt = '使用';
				btncls = 'buff5';
				suo = ''
				yinying = '';
			} else if (ishas == 0 && isuse == 0) { //未拥有未使用
				btntxt = '合成';
				btncls = 'buff6';
				suo = '<div class="suodi">' +
					'<img src="../img/home/suo.png" alt="">' +
					'<span>拥有地图：' + _data[i].debris + '/' + _data[i].active + '</span>' +
					'</div>';
				yinying = 'buffimg2';
			}
			firstimg = '<img class="firstimg" src="' + IMG_DOMAIN + _data[i].logo + '" alt="">';
			// console.log(suo);
			if (i < _data.length - 1) {
				html += '<div class="buff">' +
					'<div class="buffimg ' + yinying + '">' +
					firstimg +
					'<img class="sousuo" src="../img/home/sousuo.png" alt="">' +
					'<div class="buffimgin">' +
					'<img src="../img/home/shijian.png" alt="">' +
					'<span>' + time + '</span>' +
					'</div>' +
					suo +
					'</div>' +
					'<div class="buffLeft">' +
					'<p class="buff1">' + _data[i].name + '</p>' +
					'<span class="buff2">' + _data[i].txt + '</span>' +
					'<span class="' + cls + '">(' + txt + ')</span>' +
					'<button class="' + btncls + '" data="' + _data[i].id + '">' + btntxt + '</button>' +
					'</div>' +
					'</div>'
			} else {
				let txt6 = _data[i].is_get == 0 ? '领取' : '已领取'
				let cls6 = _data[i].is_get == 0 ? '' : 'jiezhiimggray'
				is_get = _data[i].is_get;
				html += '<div class="buff">' +
					'<div class="buffimg ' + yinying + '">' +
					firstimg +
					'<img class="sousuo" src="../img/home/sousuo.png" alt="">' +
					'<div class="buffimgin">' +
					'<img src="../img/home/shijian.png" alt="">' +
					'<span>' + time + '</span>' +
					'</div>' +
					suo +
					'</div>' +
					'<div class="buffLeft">' +
					'<p class="buff1">' + _data[i].name + '</p>' +
					'<span class="buff2">' + _data[i].txt + '</span>' +
					'<span class="' + cls + '">(' + txt + ')</span>' +
					'<div class="btnbtn2">' +
					'<button class="' + btncls + '" data="' + _data[i].id + '">' + btntxt + '</button>' +
					'<button class="buff4 ' + cls6 + '" id="guiderecieve">' + txt6 + '</button>' +
					'</div>' +
					'</div>' +
					'</div>'
			}

		}
		// console.log(html);
		ele.buffList.innerHTML = html;


		let guiderecieve = $('#guiderecieve');
		guiderecieve.style.display = is_block;
		guiderecieve.onclick = () => {
			if (is_get == 1) {
				openTips('该奖励已领取')
			} else {
				guideGold()
			}
		}


		let buff6s = $('.buff6');
		for (let i = 0; i < buff6s.length; i++) {
			buff6s[i].onclick = (e) => {
				// console.log(e.target.getAttribute('data'));
				jobSynthesis(e.target.getAttribute('data'));
			}
		}

		let buff5s = $('.buff5');
		for (let i = 0; i < buff5s.length; i++) {
			buff5s[i].onclick = (e) => {
				// console.log(e.target.getAttribute('data'));
				jobUseit(e.target.getAttribute('data'));
			}
		}

		let sousuos = $('.sousuo');
		for (let i = 0; i < sousuos.length; i++) {
			sousuos[i].onclick = () => {
				location.href = '../page/preview.html?id=' + i;
			}
		}
	}

	// 领取 地段天空之城 每日登录388金币
	function guideGold() {
		let token = getCookie("token");
		ajax({
			url: API_PATH.GUIDE_GET_GOLD,
			method: 'GET',
			header: {
				'Authorization': token,
			},
			success: res => {
				if (res.code == 1) {
					openTips(res.msg);
					jobList()
				} else openTips(res.msg || '未知错误');
			}
		});
	}

	//地段合成
	function jobSynthesis(index) {
		let token = getCookie("token");
		ajax({
			url: API_PATH.JOB_SYNTHESIS,
			method: 'POST',
			header: {
				'Authorization': token,
			},
			data: {
				id: index
			},
			success: res => {
				if (res.code == 1) {
					openTips(res.msg);
					jobList();
				} else openTips(res.msg || '未知错误');
			}
		});
	}

	//使用地段
	function jobUseit(index) {
		let token = getCookie("token");
		ajax({
			url: API_PATH.JOB_USE_IT,
			method: 'POST',
			header: {
				'Authorization': token,
			},
			data: {
				id: index
			},
			success: res => {
				if (res.code == 1) {
					openTips(res.msg);
					jobList();
					// for (let i = 0; i < inval.length; i++) {
					// 	clearInterval(inval[i]);
					// }
					// getJzList();
					getredPonit();
				} else openTips(res.msg || '未知错误');
			}
		});
	}

	var signImg = ['', '../img/public/jinbi.png', '../img/public/dami.png', '../img/leyuan/cuizi1.png',
		'../img/home/kuojian.png'
	]

	//确认签到
	ele.signConfirm.onclick = () => {
		toSign()
	}

	//签到列表
	function signList() {
		let token = getCookie("token");
		ajax({
			url: API_PATH.SIGN_LIST,
			method: 'GET',
			header: {
				'Authorization': token,
			},
			success: res => {
				if (res.code == 1) {
					// for(let i = 0; i < inval.length; i++) {
					// 	clearInterval(inval[i]);
					// }
					signDraw(res.data);
					// ele.look.innerHTML = '<span>' + res.data.sp_num + '/' + res.data.list[0].sp_num +
					// '</span>' + '<p id="lookin"></p>'
					// ele.looknum.innerHTML = '看' + res.data.sp_num + '次视频后即可领取每日奖励';
					// $('#lookin').style.width = parseInt(res.data.sp_num / res.data.list[0].sp_num) + '00%';
					if (res.data.today_info.is_click == 1) {
						ele.signConfirm.onclick = null
						ele.signConfirm.style.display = 'none';
						ele.signConfirm.innerHTML = '已领取'
						ele.signConfirm.classList.add('recieved')
					}
				}
				// else openTips(res.msg);
			}
		});
	}

	//签到
	function toSign() {
		let token = getCookie("token");
		ajax({
			url: API_PATH.TO_SIGN,
			method: 'GET',
			header: {
				'Authorization': token,
			},
			success: res => {
				if (res.code == 1) {
					openTips(res.msg);
					getJzList();
					signList();
				} else openTips(res.msg || '未知错误');
			}
		});
	}

	//签到渲染
	function signDraw(_data) {
		let html = '';
		// console.log(_data.length );
		let is_reieve = '';
		let cls = '';
		let clsborder = '';
		let is_reieve7 = '';
		let cls7 = '';
		let j = '';
		let type = '';
		let nowday = '';
		nowday = parseInt(_data.today_info.id % 8);
		for (let i = 0; i < _data.list.length - 1; i++) {
			console.log(_data.list[i].type);
			is_reieve = _data.list[i].is_click == 0 ? '' : '已领取';
			cls = _data.list[i].is_click == 0 ? 'recieve' : 'recieved';
			j = i + 1;
			clsborder = nowday == j ? 'clsborder' : ''
			html += '<div class="modal_listin ' + clsborder + '">' +
				'<div class="daynum">' +
				'<span>第</span>' +
				'<p>' + j + '</p>' +
				'<span>天</span>' +
				'</div>' +
				'<div class="thing">' +
				'<img src="' + signImg[_data.list[i].type] + '" alt="">' +
				'<span>x' + _data.list[i].money + '</span>' +
				'</div>' +
				'<div class="' + cls + '">' + is_reieve + '</div>' +
				'</div>';
		}
		// console.log(html);
		ele.sign_list.innerHTML = html;

		is_reieve7 = _data.list[6].is_click == 0 ? '' : '已领取';
		cls7 = _data.list[6].is_click == 0 ? 'recieve' : 'recieved';

		ele.sign7.innerHTML = '<div class="tit7">7天登陆可领取超大礼包！</div>' +
			'<div class="day7">' +
			'<div class="day7left">' +
			'<div class="daynum">' +
			'<span>第</span>' +
			'<p class="red">7</p>' +
			'<span>天</span>' +
			'</div>' +
			'<div class="thing">' +
			'<img src="' + signImg[_data.list[6].type] + '" alt="">' +
			// '<span>扩建许可证</span>' +
			'</div>' +
			'<span class="shenyi">X' + _data.list[6].money + '</span>' +
			'</div>' +
			'<div class="warm_tips">' +
			'温馨提示：下周也会有丰厚奖励' +
			'</div>' +
			'<div class="' + cls7 + '">' + is_reieve7 + '</div>' +
			'</div>'
	}

	// 转盘
	let tipsdata = null

	var turn_data = null;

	function ini() {
		let token = getCookie("token");
		ajax({
			url: API_PATH.GET_TURNTABLE_LIST,
			method: 'GET',
			header: {
				Authorization: token
			},
			success: res => {
				if (res.code == 1) {
					ggcishu = res.data.data.has_sp_num
					dataimg(res.data.list.list)
					ele.adnum.innerText = res.data.list.detail.max_num - res.data.data.free_num + res
						.data.data.has_sp_num
					ele.adallnum.innerText = '/' + res.data.list.detail.max_num
					if (res.data.list.detail.max_num - res.data.data.free_num + res.data.data
						.has_sp_num >= res.data.list.detail.max_num) {
						ele.adnum.className = 'fontblue'
					}
					ele.meiri_ad.innerHTML = '(' + res.data.data.has_sp_num + '/' + res.data.list.detail
						.num + ')'
					turn_data = res.data.list.list
				} else {
					openTips(res.msg)
				}
			}
		});
	}

	function dataimg(data) {
		let str = '';
		for (let i = 0; i < data.length; i++) {
			let lv = data[i]
			let namet = lv.info.name
			let nameimg = lv.info.b_type == 1 ? '../img/home/yinbi3.png' : lv.info.b_type == 2 ?
				'../img/home/jinbi.png' : lv.info.b_type == 3 ? '../img/public/cuizi.png' : IMG_DOMAIN + lv.info
				.logo

			str += '<div class="nape">' +
				// '<span>' + namet + '</span>' +
				'<img class="jaib" src="' + nameimg + '">' +
				'<span>' + lv.num + '</span>' +
				'</div>';
		}
		// console.log(str);
		ele.listimg.innerHTML = str;
		openMdl(ele.modal_blind);
		position();
	}

	var oTurntable = $('#turntable')
	var cat = 45; //总共8个扇形区域，每个区域45度
	var offOn = true; //是否正在抽奖
	var transformRotate = 0 //转圈度数 
	var check = true
	let screenWidth = window.screen.availWidth;
	let screenHeight = window.screen.availHeight;

	var randmArr = [0, 2, 12, 24, 42, 64, 100] //概率计算为randmArr[i-1]和randmArr[i]之
	let rdmnum = null


	function position() {
		//半径
		var radius = 94;
		//每一个BOX对应的角度;
		var avd = 45;
		//每一个BOX对应的弧度;
		var ahd = avd * Math.PI / 180;

		// ele.turntable = $('#turntable');
		// console.log($('#turntable'));
		// var dotLeft = (document.querySelector('.turntable').offsetWidth - document.querySelector(".zhizheng").offsetWidth) / 2
		// var dotTop = (document.querySelector('.turntable').offsetHeight - document.querySelector(".zhizheng").offsetWidth) / 2
		var dotLeft = 92
		var dotTop = 90
		ele.nape = $('.nape')
		for (let i = 0; i < ele.nape.length; i++) {
			ele.nape[i].style.left = Math.sin((ahd * i)) * radius + dotLeft + 'px'
			ele.nape[i].style.top = Math.cos((ahd * i)) * radius + dotTop + ele.nape[i].offsetHeight / 2 + 'px'
			ele.nape[i].style.transform = `rotate(-${avd * i}deg)`
		}

	}

	//旋转
	//TODO: 规定中奖区间，通过区间判定值
	var prevrdm = 45 / 2; //缓存上一次的旋转度
	var obj = {} //产生的随机数的次数
	var form = {} //统计中奖的概率
	var timer = null

	function ratating(j) {
		var timer = null;
		const rdm = parseInt(Math.random() * (100 - 1) + 1); //随机的数
		var nextrdm = 0; //本次旋转度
		// console.log('rdm=' + rdm);
		// console.log('num=' + num);
		clearTimeout(timer);
		timer = null
		timer = setTimeout(function() {
			// console.log(rdmnum);
			rdmnum = j;
			if (rdmnum > 8 || rdmnum % 8 != 0) {
				rdmnum = rdmnum % 8
			} else if (rdmnum % 8 == 0) {
				rdmnum = 0
			}
			// console.log(rdmnum);
			nextrdm = Math.floor((rdmnum * cat) - 24); //定义本次抽奖结果
			// console.log(nextrdm);
			var biginRotate = 4 * 360 + (360 - prevrdm) //定义默认的旋转圈数，同时补全使轮盘置零，
			prevrdm = nextrdm

			transformRotate = nextrdm + biginRotate + transformRotate //本次旋转的度
			// console.log(nextrdm, biginRotate, transformRotate);
			// 测试中奖的概率时，把下面注释掉，同时将timeout 时间设置为0  278  288.9   354  320  312.7  236
			oTurntable.style.transform = "rotate(" + transformRotate + "deg)";



			setTimeout(function() {
				offOn = !offOn;
				check = true
				// 统计中奖概率
				// if (!form['a' + rdmnum]) {
				// 	form['a' + rdmnum] = 1;
				// } else {
				// 	form['a' + rdmnum]++
				// }
				// console.log(nextrdm, cat, tipsdata);
				// // console.log('transformRotate=' + transformRotate);
				// if (nextrdm <= cat * 1) { }
				// else if (nextrdm <= cat * 2) { }
				// else if (nextrdm <= cat * 3) { }
				// else if (nextrdm <= cat * 4) { }
				// else if (nextrdm <= cat * 5) { }
				// else if (nextrdm <= cat * 6) { }
				// else if (nextrdm <= cat * 7) { }
				// else if (nextrdm <= cat * 8) { }
			}, 4000);
		}, 30);
	}



	ele.oPointer.onclick = function() {
		handle()
	}

	function handle() {
		if (check) {
			check = false
			let token = getCookie("token");
			ajax({
				url: API_PATH.GET_TURNTABLE,
				method: 'POST',
				header: {
					Authorization: token
				},
				success: res => {
					// console.log(res);
					if (res.code == 1) {
						// for(let i = 0; i < inval.length; i++) {
						// 	clearInterval(inval[i]);
						// }
						// ini();
						let j = 0;
						for (let i = 0; i < turn_data.length; i++) {
							if (res.data.id == turn_data[i].id) {
								if (i == 7) {
									j = 4;
								} else {
									j = i + 5;
								}
							}
						}
						if (offOn) {
							offOn = !offOn;
							rdmnum = res.data.id
							// console.log(num);
							setTimeout(() => {
								// openTips(res.msg)
								ele.tipsbtn.innerHTML = '领取';
								ele.tipsbtn.classList.add('tips3_recieve');
								ele.recieveimg.src = res.data.info.b_type == 1 ?
									'../img/home/yinbi3.png' : res.data.info.b_type == 2 ?
									'../img/home/jinbi3.png' : IMG_DOMAIN + res.data.info.logo;
								ele.recievenum.innerHTML = res.data.num;
								closeMdl(ele.modal_blind);
								openMdl(ele.modal_tips2);
							}, 4000);
							ratating(j);
							// ini();
						}
						getJzList();
					} else {
						openTips(res.msg)
						check = true
					}
				}
			});
		}
	}



	// 金币记录
	function getBrickList(page) {
		ele.more1.innerText = '加载中...';
		let token = getCookie("token");
		ajax({
			url: API_PATH.GET_BRICK_LIST,
			method: 'POST',
			header: {
				'Authorization': token,
			},
			data: {
				page: page
			},
			success: res => {
				if (res.code == 1) {
					let detail = res.data.data;
					if (detail.length === 0) {
						page = 0;
						ele.more2.style.display = "none";
						ele.empty2.style.display = "flex";
					} else {
						drawgetBrickList(detail);
						page2++;
						if (page2 > res.data.last_page) {
							ele.more2.innerText = '没有更多了';
							ele.more2.onclick = null;
						} else {
							ele.more2.innerText = '加载更多';
							ele.more2.onclick = () => getBrickList(page2);
						}
					}
				} else openTips(res.msg || '未知错误');
			}
		});
	}

	// 金币记录渲染
	function drawgetBrickList(data) {
		if (data.length === 0) {
			page2 = 0;
			ele.more2.style.display = "none";
			ele.empty2.style.display = "flex";
		} else {
			let str = '';
			for (let i = 0; i < data.length; i++) {
				let resume = data[i].remark;
				let sign = data[i].operation_type == 1 ? '+' : '-';
				str += '<div class="item">' +
					'	<div class="left">' +
					'		<div class="right">' +
					'			<p class="mobile">' + data[i].remark + '</p>' +
					'			<p class="time">' + data[i].created_at + '</p>' +
					'		</div>' +
					'	</div>' +
					'	<p class="amount">' + sign + data[i].money + '</p>' +
					'</div>';
			}
			ele.list_today.innerHTML += str;
		}
	}


	// 金币兑换
	function getGoldList(page) {
		ele.more1.innerText = '加载中...';
		let token = getCookie("token");
		ajax({
			url: API_PATH.GOLD_RECORD,
			method: 'GET',
			header: {
				'Authorization': token,
			},
			data: {
				page: page
			},
			success: res => {
				if (res.code == 1) {
					let detail = res.data.list.data;
					if (detail.length === 0) {
						page1 = 0;
						ele.more1.style.display = "none";
						ele.empty1.style.display = "flex";
					} else {
						drawgetGoldList(detail);
						page1++;
						if (page1 > res.data.list.last_page) {
							ele.more1.innerText = '没有更多了';
							ele.more1.onclick = null;
						} else {
							ele.more1.innerText = '加载更多';
							ele.more1.onclick = () => getGoldList(page1);
						}
					}
				} else openTips(res.msg || '未知错误');
			}
		});
	}

	// 金币兑换渲染
	function drawgetGoldList(data) {
		if (data.length === 0) {
			page1 = 0;
			ele.more1.style.display = "none";
			ele.empty1.style.display = "flex";
		} else {
			let str = '';
			for (let i = 0; i < data.length; i++) {
				let resume = data[i].remark;
				let sign = data[i].operation_type == 1 ? '+' : '-';
				str += '<div class="item">' +
					'	<div class="left">' +
					'		<div class="right">' +
					'			<p class="mobile">' + resume + '</p>' +
					'			<p class="time">' + data[i].created_at + '</p>' +
					'		</div>' +
					'	</div>' +
					'	<p class="amount">' + sign + data[i].money + '</p>' +
					'</div>';
			}
			ele.list_all.innerHTML += str;
		}
	}

	// 大转盘
	ele.huifu_ad.onclick = () => {
		adv_index();
		if (ad_see_num >= ad_max_num || ggcishu >= 5) {
			openTips('今日视频次数已达上限，请明日再来')
		} else {
			addTime();
			if (is_guangg == 0) {
				is_guangg = 1;

				extradata = 2;

				setTimeout(() => {
					is_guangg = 0
				}, 2000)

				if (device == 'ios') {
					loadPlayRewardVideo(2)
				} else if (device == 'android') {
					loadAd(2);
				} else {
					openTips('请下载安卓最新版体验')
				}
			}
		}
	}

	var yyshi = null;
	if (getCookie('xianzai') >= +new Date()) {
		adv_index();
		yeyedao();
	}

	function yeyedao() {
		let lasttime = getCookie('xianzai');
		// if (getCookie('yy_xianzhi_time') == 0) {
			clearInterval(yyshi);
			yyshi = setInterval(() => {
				if (lasttime <= +new Date()) {
					clearInterval(yyshi);
					ele.ad_action.innerHTML = `<img src="http://img.qxgs.cc/tiantianlaishouzu/img/mine/action.png" alt="">
												<span>看广告领取</span>`;
					return;
				} else {
					ele.ad_action.onclick = null
				}
				ele.ad_action.innerHTML = getCountTimeMiao(lasttime);
			}, 1000)
		// }
	}


	// 离线奖励  传7  广告
	ele.seeadv.onclick = () => {
		if (ad_see_num >= ad_max_num) {
			openTips('今日视频次数已达上限，请明日再来')
		} else {
			if (is_guangg == 0) {
				is_guangg = 1

				extradata = 7;

				setTimeout(() => {
					is_guangg = 0
				}, 2000)

				if (device == 'ios') {
					// {userid:'123456',extradata:'测试内容'}
					// window.webkit.messageHandlers.loadPlayRewardVideo.postMessage({userid:uid,extradata:1});
					loadPlayRewardVideo(7)
				} else if (device == 'android') {
					// {userid:'123456',extradata:'测试内容'}
					// window.webkit.messageHandlers.loadPlayRewardVideo.postMessage({userid:uid,extradata:1});
					loadAd(7);
				} else {
					openTips('请下载安卓最新版体验')
				}
			}
		}
	}

	function loadPlayRewardVideo(extradata) {
		//调用激励视频广告方法
		extradata = extradata.toString()
		uid = uid.toString()
		window.webkit.messageHandlers.loadPlayRewardVideo.postMessage({
			userId: uid,
			extraData: extradata
		});
		// window.webkit.messageHandlers.loadPlayRewardVideo.postMessage("12345");
	}


	function onRewardLoadFailed() {
		//激励视频失败回调
		// alert("激励视频请求失败");
		// is_guangg = 1
	}

	function onRewardVideoVerify() {
		//激励视频奖励达成回调
		// alert("激励视频奖励达成了");
		// is_guangg = 1
		if (extradata == 1) {
			ele.tipsbtn.innerHTML = '领取';
			ele.tipsbtn.classList.remove('tips3_recieve');
			ele.recieveimg.src = '../img/home/yinbi3.png';
			ele.recievenum.innerHTML = yinyue_num + '银币';
			closeMdl(ele.modal_present);
			openMdl(ele.modal_tips2);
		}
		if (extradata == 3) {
			closeMdl(ele.modal_fountain);
		}
		// for(let i = 0; i < inval.length; i++) {
		// 	clearInterval(inval[i]);
		// }
		getJzList();
	}

	function onRewardVideoClose() {
		//激励视频关闭回调
		// alert("激励视频关闭了");
		// is_guangg = 1
		// for(let i = 0; i < inval.length; i++) {
		// 	clearInterval(inval[i]);
		// }
		getJzList();
	}

	// 加载广告 安卓
	function loadAd(extradata) {
		window.android.loadPlayRewardVideo('1661241482792681560', uid, extradata, "callBack3");
	}

	// 激励视频回调：
	window.callBack3 = function(params) {
		if (params.code == 2) {
			// openTips('奖励已送达')
			//奖励达成回调
			// is_guangg = 1
			// for(let i = 0; i < inval.length; i++) {
			// 	clearInterval(inval[i]);
			// }
			setCookie('yy_xianzhi_time', '0')
			if (extradata == 1) {
				ele.tipsbtn.innerHTML = '领取';
				ele.tipsbtn.classList.remove('tips3_recieve');
				ele.recieveimg.src = '../img/home/yinbi3.png';
				ele.recievenum.innerHTML = yinyue_num + '银币';
				closeMdl(ele.modal_present);
				openMdl(ele.modal_tips2);
				// getJzList();
				// getredPonit();
			}
			if (extradata == 2) {
				// ini();
				closeMdl(ele.modal_blind);
				closeMdl(ele.modal_tips);
				// getJzList();
				// getredPonit();
			}
			if (extradata == 3) {
				closeMdl(ele.modal_fountain);
				// getJzList();
				// getredPonit();
			}
			if (extradata == 7) {
				ele.tipsbtn.innerHTML = '领取';
				ele.tipsbtn.classList.remove('tips3_recieve');
				ele.recieveimg.src = '../img/home/yinbi3.png';
				ele.recievenum.innerHTML = rewardag.innerHTML + '银币';
				closeMdl(lx_reward);
				openMdl(ele.modal_tips2);
				// getJzList();
				// getredPonit();
			}
			setTimeout(() => {
				getJzList();
				getredPonit();
			}, 500)
			// alert('chenggong')
		}
		if (params.code == 1) {
			setCookie('yy_xianzhi_time', '0')
			// is_guangg = 1
			// alert(params)
			// openTips('奖励已送达')
			// if (extradata == 1) {
			// 	ele.tipsbtn.innerHTML = '领取';
			// 	ele.tipsbtn.classList.remove('tips3_recieve');
			// 	ele.recieveimg.src = '../img/home/yinbi3.png';
			// 	ele.recievenum.innerHTML = yinyue_num + '银币';
			// 	closeMdl(ele.modal_present);
			// 	openMdl(ele.modal_tips2);
			// }
			// if (extradata == 2) {
			// 	// ini();
			// 	closeMdl(ele.modal_blind);
			// 	closeMdl(ele.modal_tips);
			// }
			// if (extradata == 3) {
			// 	closeMdl(ele.modal_fountain);
			// }
			// if (extradata == 7) {
			// 	ele.tipsbtn.innerHTML = '领取';
			// 	ele.tipsbtn.classList.remove('tips3_recieve');
			// 	ele.recieveimg.src = '../img/home/yinbi3.png';
			// 	ele.recievenum.innerHTML = rewardag.innerHTML + '银币';
			// 	closeMdl(lx_reward);
			// 	openMdl(ele.modal_tips2);
			// }
			setTimeout(() => {
				getJzList();
				getredPonit();
			}, 500)
			//展现回调
		}
		if (params.code == 0) {
			setCookie('yy_xianzhi_time', '0')
			// is_guangg = 1
			// alert(params)
			alert('广告拉取错误', params);
			//错误回调：错误信息：params.msg
		}
	}

	let givesxf = '';
	let dianji_id = '';

	function userInfo(_data) {
		// ele.heardimg.src = _data.info.head_pic ? IMG_DOMAIN + _data.info.head_pic : '';
		// console.log(_data.info.head_pic != null);
		if (_data.info.head_pic != null) {
			ele.heardimg.src = IMG_DOMAIN + _data.info.head_pic;
		} else {
			ele.heardimg.src = _data.info.sex == 1 ? '../img/my/tx1.png' : '../img/my/tx2.png'
		}
		ele.nickname.innerHTML = _data.info.nick_name == null ? '天天来收租' : _data.info.nick_name;
		// console.log(_data.hammer);
		ele.yinbi.innerHTML = _data.hammer;
		yinbiHammer = _data.hammer;
		ele.jinbi.innerHTML = Math.floor(_data.diamond * 100) / 100;
		ele.jinbi3.innerHTML = _data.diamond;
		ele.rate.innerHTML = _data.cs_num + '/秒';
		// ele.yinbi_cs.innerHTML = _data.cs_num + '/秒';
		ele.dangqian_cs.innerHTML = _data.hammer
		// ele.dangqian_cs2.innerHTML = _data.hammer
		ele.apartmoney.innerHTML = _data.hammer
		ele.toplv.innerHTML = _data.vip == 0 ? '<p><span>ID：' + _data.invite_code + '</span></p>' :
			'<img src="../img/home/zuan' + _data.vip + '.png" alt=""><p><span>V' + _data.vip + '</span></p>'
	}



	// 爷爷的馈赠（广告回调）
	function gameWatchAdv(is_yy) {
		let token = getCookie("token");
		ajax({
			url: API_PATH.GAME_WATCH_ADV,
			method: 'GET',
			header: {
				'Authorization': token,
			},
			success: res => {
				if (res.code == 1) {
					if (is_yy == 1) {
						ele.yeye1.innerHTML = '银币+' + res.data
						yinyue_num = res.data;
						if (ele.yy_timer.innerHTML != '') {
							openTips('倒计时结束才能打开哦~')
						} else {
							yeyedao();
							openMdl(ele.modal_present);
						}
					} else {
						getCongig()
					}
				} else {
					openTips(res.msg || '未知错误');
				}
			}
		});
	}



	// function debounce(fn, delay) {
	//     var timer = null;
	//     return function () {
	//         if (timer) clearTimeout(timer);
	//         timer = setTimeout(function () {
	//             fn();
	//         },delay)
	//     }
	// }



	// 杨阳 邮件
	ele.modal_email = $('#modal-email');
	ele.close_email = $('#close-email');
	ele.emailBox = $('#emailBox');
	ele.email = $('#email');

	ele.alldelete = $('#alldelete'); //一键删除
	ele.allget = $('#allget'); //一键领取

	//  杨阳 邮件详情
	ele.modal_emaildetail = $('#modal-emaildetail');
	ele.close_emaildetail = $('#close-emaildetail');
	ele.emailID = $('#emailID');
	ele.emailinfoma = $('#emailinfoma');
	ele.etime = $('#etime');
	ele.edetailsList = $('#edetailsList');
	ele.clickling = $('#clickling');

	// 杨阳 邮件领取成功弹框
	ele.modal_getsuccess = $('#modal-getsuccess');
	ele.close_getsuccess = $('#close-getsuccess');
	ele.getsuccessList = $('#getsuccessList');

	// 邮件详情

	// 杨阳 邮件
	// 打开邮件弹框
	ele.email.onclick = () => {
		getEmailList();
		ele.modal_email.style.display = 'block'
	}
	// 关闭弹框
	ele.close_email.onclick = () => {
		ele.modal_email.style.display = 'none'
	}

	ele.empty3 = $('#empty3');

	function getEmailList() {
		let token = getCookie("token");
		ajax({
			url: API_PATH.YOUJIANLIST,
			method: 'GET',
			header: {
				'Authorization': token,
			},
			success: res => {
				if (res.code == 1) {
					let detail = res.data
					if (detail.length == 0) {
						ele.emailBox.innerHTML = ''
						ele.empty3.style.display = "flex";
					} else {
						ele.emailBox.innerHTML = ''
						ele.empty3.style.display = "none";
						drawDetail(detail);
					}
				} else openTips(res.msg);
			}
		});
	}

	let adjdh = '';
	// get  邮件红点的 mail_red 1就是有红点
	function getredPonit() {
		let token = getCookie("token");
		ajax({
			url: API_PATH.GET_RED_POINT,
			method: 'GET',
			header: {
				'Authorization': token,
			},
			success: res => {
				if (res.code == 1) {
					clearInterval(time_yy);
					adjdh = res.data.yy_over_time * 1000;
					setCookie('xianzai', adjdh)
					// console.log(res.data.yy_over_time * 1000 <= +new Date());
					time_yy = setInterval(() => {
						if (res.data.yy_over_time * 1000 <= +new Date()) {
							clearInterval(time_yy);
							ele.yy_timer.innerHTML = ``;
							quanju_yy = 0;
							return;
						}
						quanju_yy = JSON.stringify(getCountTimeMin(res.data.yy_over_time))
						// console.log(quanju_yy);
						ele.yy_timer.innerHTML = getCountTimeMin(res.data.yy_over_time)
					}, 1000)
					pq_time = res.data.over_time;
					is_hong = res.data.hb_num;
					nowbg = res.data.lot_list.id;
					// pq_time = res.data.over_time;
					// is_hong = res.data.hb_num;
					// houseNum = res.data.house_num;
					ele.tips2.style.display = res.data.hb_num == 0 ? 'none' : 'block';
					if (nowbg == 1) {
						ele.zone.style.backgroundColor = '#33adb8';
					} else if (nowbg == 2) {
						ele.zone.style.backgroundColor = '#a9ad31';
					} else if (nowbg == 3) {
						ele.zone.style.backgroundColor = '#156261';
					} else if (nowbg == 4) {
						ele.zone.style.backgroundColor = '#32b6ee';
					} else if (nowbg == 5) {
						ele.zone.style.backgroundColor = '#a7381a';
					} else if (nowbg == 6) {
						ele.zone.style.backgroundColor = '#e0cbeb';
					}
					ele.bgimg.src = '../img/jianzu/bg' + nowbg + '.png'

					if (res.data.mail_red == 1) {
						ele.email.className = 'emailPonit';
					} else {
						ele.email.className = '';
					}
				} else openTips(res.msg);
			}
		});
	}

	function drawDetail(data) {
		let str = '';
		for (let i = 0; i < data.length; i++) {
			let yy = data[i]
			let img = ''
			// click 0 未读有奖励 1已读有奖励 4已读已领有奖励 2未读无奖励 3已读无奖励
			if (yy.click == 0) {
				img = '<img class="weidu rece-' + yy.id + '"  src="../img/youjian/weidu.png" alt="">'
			} else if (yy.click == 1) {
				img = '<img class="yidu" src="../img/youjian/yidu2.png" alt="">'
			} else if (yy.click == 2) {
				img = '<img class="yidu" src="../img/youjian/weidu2.png" alt="">'
			} else if (yy.click == 3) {
				img = '<img class="yidu" src="../img/youjian/yidu.png" alt="">'
			} else if (yy.click == 4) {
				img = '<img class="yidu" src="../img/youjian/yidu3.png" alt="">'
			}
			str += '<div class="linkemail" onclick=submits(' + yy.id + ',' + yy.click + ')>' +
				img +
				'<div class="emailinfo">' +
				'<p class="szms">欢迎来到天天来收租' + '</p>' +
				'<p><span class="emailtime">' + yy.time + '</span> ' + '<span class="guoqitime">邮件过期时间：' + yy
				.over_time + '</span></p>' +
				'</div>' +
				'</div>';
		}
		ele.emailBox.innerHTML = str;
	}

	// 点击出现弹框详情
	window.submits = submits

	function submits(id) {
		// console.log(id);
		let token = getCookie("token");
		ajax({
			url: API_PATH.YOUJIANLISTDETAIL,
			method: 'get',
			header: {
				'Authorization': token,
			},
			data: {
				id: id
			},
			success: res => {
				if (res.code == 1) {
					ele.emailID.innerText = res.data.nick_name
					ele.emailinfoma.innerHTML = res.data.info
					ele.etime.innerHTML = res.data.time
					let str = '';
					// if (res.data.more_sku.length == 0) {
					// 	str = '<p class="detailbx">暂无道具奖励</p>'
					// }
					if (res.data.click == 2 || res.data.click == 3) {
						str = '<p class="detailbx">暂无道具奖励</p>'
					}
					for (let i = 0; i < res.data.more_sku.length; i++) {
						let data = res.data.more_sku
						let yy = data[i]
						let img = ''
						let pp = ''
						// console.log(res.data.more_sku == []);
						if (yy.a_type == 2) {
							if (yy.b_type == 1) {
								// 银币
								img = '<img src="../img/home/yinbi3.png" alt="">'
							} else if (yy.b_type == 2) {
								// 金币
								img = '<img src="../img/home/jinbi3.png" alt="">'
							} else if (yy.b_type == 3) {
								// 零钱
								img = '<img src="../img/home/qb.png" alt="">'
							}
							pp = '<div class="debox">' +
								'<div class="wups">' +
								img +
								'</div>' +
								'<p class="enums">' + yy.num + '</p>' +
								'</div>'

						} else if (yy.a_type != 2) {
							img = '<img src="' + IMG_DOMAIN + yy.info.logo + '" alt="">'
							pp = '<div class="debox">' +
								'<div class="wups">' +
								img +
								'</div>' +
								'<p class="enums">' + yy.num + '</p>' +
								'</div>'
						}

						// str += '<div class="debox">' +
						// 	'<div class="wups">' +
						// 	img +
						// 	'</div>' +
						// 	'<p class="enums">' + yy.num + '</p>' +
						// 	'</div>';
						str += pp;
					}
					ele.edetailsList.innerHTML = str;
					// state 0 已读未领取 1已读已领取
					if (res.data.click == 2 || res.data.click == 3) {
						ele.clickling.style.display = 'none'
					} else {
						ele.clickling.style.display = 'block'
					}
					// console.log(res.data.record.state);
					// res.data.click != 2 && res.data.record.state == 0 || res.data.click != 3 && res.data.record.state == 0
					if (res.data.click == 0 || res.data.click == 1) {
						ele.clickling.src = '../img/youjian/receive.png'
						// 领取
						ele.clickling.onclick = () => {
							let token = getCookie("token");
							ajax({
								url: API_PATH.YOUJIANGET,
								method: 'GET',
								header: {
									Authorization: token
								},
								data: {
									id: id
								},
								success: res => {
									if (res.code == 1) {
										// console.log(res.data);
										let btn = $('.rece-' + id)[0];
										// btn.src = "../img/youjian/yidu.png"
										// btn.classList.remove('weidu');
										// btn.classList.add('yidu');
										ele.clickling.src =
											'../img/youjian/received.png'
										getsuccess(res.data)
										getEmailList()
										ele.modal_getsuccess.style.display = 'block'
									} else {
										openTips(res.msg);
									}

								}
							})
						}
					} else if (res.data.click == 4) {
						ele.clickling.src = '../img/youjian/received.png'
						ele.clickling.onclick = null
					}
				} else {
					openTips(res.msg);
				}
			}
		})

		ele.modal_emaildetail.style.display = 'block'
	}

	function getsuccess(data) {
		let str = '';
		for (let i = 0; i < data.length; i++) {
			let yy = data[i]
			let img = ''
			if (yy.a_type && yy.a_type == 2) {
				if (yy.b_type == 1) {
					// 银币
					img = '<img src="../img/home/yinbi3.png" alt="">'
				} else if (yy.b_type == 2) {
					// 金币
					img = '<img src="../img/home/jinbi3.png" alt="">'
				} else if (yy.b_type == 3) {
					// 零钱
					img = '<img src="../img/home/qb.png" alt="">'
				}

			} else {
				img = '<img src="' + IMG_DOMAIN + yy.info.logo + '" alt="">'
			}
			str += '<div class="debox">' +
				'<div class="wups">' +
				img +
				'</div>' +
				'<p class="enums">' + yy.num + '</p>' +
				'</div>';
		}
		ele.getsuccessList.innerHTML = str;
	}

	// 一键删除
	ele.alldelete.onclick = () => {
		let token = getCookie("token");
		ajax({
			url: API_PATH.ALLDETETE,
			method: 'GET',
			header: {
				Authorization: token
			},
			success: res => {
				if (res.code == 1) {
					openTips(res.msg);
					getredPonit();
					getEmailList();
				} else openTips(res.msg);
			}
		});
	}
	// 一键领取
	ele.allget.onclick = () => {
		let token = getCookie("token");
		ajax({
			url: API_PATH.ALLGET,
			method: 'GET',
			header: {
				Authorization: token
			},
			success: res => {
				if (res.code == 1) {
					getredPonit();
					let str = '';
					for (let i = 0; i < res.data.length; i++) {
						let yy = res.data[i]
						let img = ''
						if (yy.a_type == 2) {
							if (yy.b_type == 1) {
								// 银币
								img = '<img src="../img/home/yinbi3.png" alt="">'
							} else if (yy.b_type == 2) {
								// 金币
								img = '<img src="../img/home/jinbi3.png" alt="">'
							} else if (yy.b_type == 3) {
								// 零钱
								img = '<img src="../img/home/qb.png" alt="">'
							}

						} else {
							img = '<img src="http://rent.qunx.cc:56/storage' + yy.info.logo +
								'" alt="">'
						}
						str += '<div class="debox">' +
							'<div class="wups">' +
							img +
							'</div>' +
							'<p class="enums">' + yy.num + '</p>' +
							'</div>';
					}
					ele.getsuccessList.innerHTML = str;
					getEmailList();
					for (let i = 0; i < inval.length; i++) {
						clearInterval(inval[i]);
					}
					getJzList()
					ele.modal_getsuccess.style.display = 'block'
				} else openTips(res.msg);
			}
		});
	}

	// 关闭邮件详情弹框
	ele.close_emaildetail.onclick = () => {
		ele.edetailsList.innerHTML = ''
		ele.modal_emaildetail.style.display = 'none'
	}
	// 关闭邮件领取成功弹框
	ele.close_getsuccess.onclick = () => {
		ele.modal_getsuccess.style.display = 'none'
	}

	// 关闭租户小烦恼
	ele.modal_worried_close.onclick = () => {
		ele.modal_worried.style.display = 'none'
	}


	close_offlineRewards.onclick = () => {
		closeMdl(lx_reward);
	}




	// 幸运数字---------------------------------------------------------------------------------------------------------------------------------------------------------


	// getownnum();

	// 请求幸运数字接口
	function getownnum() {
		let token = getCookie("token");
		ajax({
			url: API_PATH.GETLUCKNUM,
			method: "GET",
			header: {
				Authorization: token,
			},
			success: (res) => {
				if (res.code == 200) {
					ele.numchance.innerHTML = `竞猜机会 :${res.data.chance}`
					ele.l_id = res.data.now_phase.id
					ele.num_text.innerHTML = `第${res.data.now_phase.phase}期`
					drawownnum(res)
					lick_number(res);
					drawnewMoban(res);
				} else openTips(res.msg || "未知错误");
			},
		});
	}

	// 渲染每日任务
	function lick_number(res) {
		let newArr = res.data.task_list.map((item, index) => {
			let img = item.state == 1 ? '<img class="son_right_img" src="../img/number/gou.png" alt="">' :
				''
			return `<div class="son_right_left">
						<p>${index + 1}.${item.describe}(${item.record_num}/${item.num})</p >
						${img}
					</div>`;
		}).join(" ");
		ele.task_num.innerHTML = newArr;
	}

	// 渲染昨日幸运数字
	function drawownnum(res) {
		if (res.data.last_res != '') {
			let html = res.data.last_res.lucky_num.map((item, index) => {
				return `<div class="son_right_img">
							<span>${item}</span>
						</div>`
			}).join('');
			ele.son_num.innerHTML = html;
		}
	}


	let luckobj = [{
			title: "第一组",
			arr: ["", "", "", "", ""],
		},
		{
			title: "第二组",
			arr: ["", "", "", "", ""],
		},
		{
			title: "第三组",
			arr: ["", "", "", "", ""],
		},
		{
			title: "第四组",
			arr: ["", "", "", "", ""],
		},
		{
			title: "第五组",
			arr: ["", "", "", "", ""],
		},
	];

	ele.zuhao = $("#zuhao");


	// 渲染我已经提交的数据
	function drawnewMoban(res) {
		for (let i = 0; i < res.data.user_lucky_nums.length; i++) {
			luckobj[i].arr = res.data.user_lucky_nums[i].chose_num
		}
		// console.log(luckobj);
		let numArr = luckobj
			.map((item) => {
				return `
						<div class="son_bottom">
							<div class="son_left">
								<p>${item.title}</p>
							</div>
							<div class="son_right">
								<div class="son_right_img">
									<span>${item.arr[0]}</span>
								</div>
								<div class="son_right_img">
									<span>${item.arr[1]}</span>
								</div>
								<div class="son_right_img">
									<span>${item.arr[2]}</span>
								</div>
								<div class="son_right_img">
									<span>${item.arr[3]}</span>
								</div>
								<div class="son_right_img">
									<span>${item.arr[4]}</span>
								</div>
							</div>
						</div>`;
			})
			.join("");
		ele.zuhao.innerHTML = numArr;
	}

	let idi = []; //用来保存选择的数据
	let arr = [
		1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
		22, 23, 24, 25, 26, 27, 28, 29, 30,
	];
	const newArr = arr
		.map((item) => {
			return `<div class="num_sonnum">${item}</div>`;
		})
		.join("");
	// 循环下面的数字
	ele.num_select.innerHTML = newArr;
	let yuer = document.querySelectorAll(".num_sonnum");

	for (let i = 0; i < yuer.length; i++) {
		yuer[i].onclick = (e) => {
			// console.log(idi);
			// console.log(e, 4444);
			// 判断点击相同的元素删除
			for (let i = 0; i < idi.length; i++) {
				if (e.target.innerHTML == Number(idi[i])) {
					idi.splice(i, 1)
					e.target.classList.remove('quanquan')
					// console.log(idi);
					return;
				}
			}
			if (e.target.className == "quanquan") {
				return;
			}
			if (idi.length >= 5) {
				return;
			}
			idi.push(Number(e.target.innerHTML));
			// console.log(idi);
			// 添加节点
			yuer[i].classList.add('quanquan');
		};
	}


	// 获取所有背景节点
	// 删除类名方法
	function cleatName(arr) {
		// console.log(arr, 555555);
		arr.forEach((item) => {
			item.classList.remove("quanquan");
		});
	}

	// 点击提交
	ele.center_tijiao.onclick = () => {
		//是否选满选满则弹窗
		// console.log(luckobj[4].arr[4]);
		if (luckobj[4].arr[4] == "") {
			ele.quanquan = document.querySelectorAll(".quanquan");
			if (idi.length != 5) {
				openTips("请选择完整号码");
			} else {
				openMdl(ele.modal_submitTo);
			}
		} else {
			openTips('您已全部选择,请提交后再来')
		}
	};


	// 点击随机选择
	ele.center_suiji = $("#center_suiji");
	ele.center_suiji.onclick = () => {

		ele.quanquan = document.querySelectorAll(".quanquan");
		cleatName(ele.quanquan);
		if (luckobj[4].arr[4] != '') {
			openTips('您已全部选择,请提交后再来')
			return
		}
		idi = [];
		let yuer = document.querySelectorAll(".num_sonnum");
		for (let i = 0; i < 5; i++) {
			idi[i] = Math.floor(Math.random() * 30) + 1; //范围是[1~10]
			for (let j = 0; j < i; j++) {
				if (idi[i] == idi[j]) {
					i--;
				}
			}
		}
		for (let j = 0; j < idi.length; j++) {
			yuer[idi[j] - 1].classList.add('quanquan')
		}
		// console.log(idi);
	};
	// 点击中奖记录
	ele.winning_record.onclick = () => {
		location.href = "../page/winningRecord.html";
	};

	// 点击确认提交后
	ele.num_detlt_submit.onclick = () => {
		// 这里发送请求
		submitmnum(idi)
	};


	// 提交选择的数据
	function submitmnum(_data) {
		let chose_num = _data.join(',')
		let token = getCookie("token");
		// console.log(chose_num);
		ajax({
			url: API_PATH.CHOSE_NUM,
			method: "POST",
			header: {
				Authorization: token,
			},
			data: {
				chose_num: chose_num,
				l_id: ele.l_id
			},
			success: (res) => {
				if (res.code == 200) {
					idi = []
					closeMdl(ele.modal_submitTo);
					getownnum();
					openTips(res.message)
					cleatName(ele.quanquan);
				} else {
					openTips(res.message || "未知错误");
				}
			},
		});
	}


	// 幸运数字活动倒计时
	var countdownjs
	countdown()

	function countdown() {
		clearInterval(countdownjs)
		var now = new Date();
		var midnight = new Date();
		midnight.setHours(24, 0, 0, 0); // 设置为今天的午夜时间
		var diff = midnight - now; // 计算距离午夜的毫秒数
		var hours = Math.floor(diff / (1000 * 60 * 60)); // 计算小时数
		var minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60)); // 计算分钟数
		var seconds = Math.floor((diff % (1000 * 60)) / 1000); // 计算秒数
		var countdownStr = hours + ":" + minutes + ":" + seconds;
		ele.djstext.innerHTML = countdownStr
		countdownjs = setInterval(() => {
			countdown()
		}, 1000)
	}

	// !无缝滚动代码
	//js无缝滚动代码
	// console.log(record_msg);

	function gundong(msgs) {
		// console.log(msgs);
		//   let timergg = null;
		//   clearInterval(timergg);
		//   let box = document.getElementById("scroll-box");
		//   let parent = $("#ui1");
		//   let parent2 = $("#ui2");
		//   let newMsg = msgs
		//     .map((item) => {
		//       return ` <div class="li">${item.info}</div>`;
		//     })
		//     .join(" ");
		//   parent.innerHTML = newMsg;
		//   parent2.innerHTML = parent.innerHTML;
		//   timergg = setInterval(autoScrollLine, 80);

		//   function autoScrollLine() {
		//     if (box.scrollTop >= parent.offsetHeight) {
		//       box.scrollTop = 0;
		//     } else {
		//       box.scrollTop++;
		//     }
		//     if (box.scrollTop % box.offsetHeight == 0) {
		//       clearInterval(timergg);
		//       setTimeout(() => {
		//         timergg = setInterval(autoScrollLine, 80);
		//       }, 1000);
		//     }
		//   }
	}

	initQIEGE();

	function initQIEGE() {
		let token = getCookie("token");
		ajax({
			method: "post",
			url: API_PATH.GET_NEW_ONE,
			header: {
				Authorization: token,
			},
			success: (res) => {
				if (res.code == 1) {
					setTimeout(() => {
						// if(res.data.data.length == 0) {
						// 	gundong('暂无公告');
						// } else {
						// 	gundong(res.data.record_msg);
						// }
						$('#tishi_p').innerHTML = res.data.info
						gundong(res.data.info);
					}, 1000);
				}
			},
			error: (err) => {
				// openTips(err.msg);
			},
		});
	}
	// ele.heardimg.onclick = ()=> {
	// 	ali()
	// }

	// 	function ali(){
	// 				let token = getCookie("token");
	// 				// console.log(token);
	// 				let alipayUrl = `https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id=2021003176606001&scope=auth_user&redirect_uri=http://ali.hfqx.xyz/home/ali_pay/get_ali_info&state=${token}`
					
	// 				let openURL = 'alipays://platformapi/startapp?appId=20000067&url=' + encodeURIComponent(alipayUrl);
					
	// 				location.href = openURL
					
	// 				// if(this.$u.os() == 'ios') {
	// 				// 	location.href = openURL
	// 				// }else if(this.$u.os() == 'android') {
	// 				// 	location.href = openURL
	// 				// }else {
	// 				// 	location.href = openURL
	// 				// }
	// 			}

})()